11/*
2- * Copyright (c) 2023 Nordic Semiconductor ASA
2+ * Copyright (c) 2024 Nordic Semiconductor ASA
33 *
44 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55 */
@@ -29,23 +29,22 @@ extern "C" {
2929int dfu_target_suit_set_buf (uint8_t * buf , size_t len );
3030
3131/**
32- * @brief See if data in buf indicates SUIT style upgrade .
32+ * @brief Initialize dfu target for specific image, perform steps necessary to receive firmware .
3333 *
34- * Not implemented as it does not currently have any use cases.
35- * Currently always returns -ENOSYS.
36- *
37- * @retval -ENOSYS
38- */
39- bool dfu_target_suit_identify (const void * const buf );
40-
41- /**
42- * @brief Initialize dfu target, perform steps necessary to receive firmware.
34+ * If you call this function, you must call dfu_target_suit_done() to finalize the firmware upgrade
35+ * before initializing any other images.
4336 *
4437 * @param[in] file_size Size of the current file being downloaded.
45- * @param[in] img_num Image pair index.
38+ * @param[in] img_num Image index.
4639 * @param[in] cb Callback for signaling events(unused).
4740 *
48- * @retval 0 If successful, negative errno otherwise.
41+ * @return 0 If successful
42+ * @return -ENODEV errno code if the buffer has not been initialized.
43+ * @return -ENXIO errno code if the partition dedicated for provided image is not found.
44+ * @return -ENOMEM errno code if the buffer is not large enough.
45+ * @return -EFAULT errno code if flash device assigned to the image is not available on the device.
46+ * @return -EBUSY errno code if the any image is already initialized and stream flash is in use.
47+ * @return other negative errno code if the initialization failed.
4948 */
5049int dfu_target_suit_init (size_t file_size , int img_num , dfu_target_callback_t cb );
5150
@@ -54,7 +53,7 @@ int dfu_target_suit_init(size_t file_size, int img_num, dfu_target_callback_t cb
5453 *
5554 * @param[out] offset Returns the offset of the firmware upgrade.
5655 *
57- * @return 0 if success, otherwise negative value if unable to get the offset
56+ * @retval 0 if success, otherwise negative value if unable to get the offset
5857 */
5958int dfu_target_suit_offset_get (size_t * offset );
6059
@@ -64,7 +63,9 @@ int dfu_target_suit_offset_get(size_t *offset);
6463 * @param[in] buf Pointer to data that should be written.
6564 * @param[in] len Length of data to write.
6665 *
67- * @return 0 on success, negative errno otherwise.
66+ * @return 0 on success
67+ * @return -EFAULT errno code if the stream flash has not been initialized for any dfu image.
68+ * @return other negative errno code if the initialization failed.
6869 */
6970int dfu_target_suit_write (const void * const buf , size_t len );
7071
@@ -73,21 +74,23 @@ int dfu_target_suit_write(const void *const buf, size_t len);
7374
7475 * @param[in] successful Indicate whether the firmware was successfully recived.
7576 *
76- * @return 0 on success, negative errno otherwise.
77+ * @retval 0 on success, negative errno otherwise.
7778 */
7879int dfu_target_suit_done (bool successful );
7980
8081/**
81- * @brief Schedule update and reset the device.
82+ * @brief Schedule an update
83+ *
84+ * This call processes SUIT envelope and requests images update.
8285 *
83- * This call requests images update and immediately starts it
84- * by resetting the device.
86+ * Firmware update will start after the device reboot.
87+ * You can reboot device, for example, by calling dfu_target_suit_reboot() .
8588 *
8689 * @param[in] img_num Given image pair index or -1 for all
8790 * of image pair indexes.
8891 *
89- * @return 0 for a successful request or a negative error
90- * code identicating reason of failure.
92+ * @retval 0 for a successful request or a negative error
93+ * code indicating reason of failure.
9194 **/
9295int dfu_target_suit_schedule_update (int img_num );
9396
@@ -96,10 +99,19 @@ int dfu_target_suit_schedule_update(int img_num);
9699 *
97100 * Cancels any ongoing updates.
98101 *
99- * @return 0 on success, negative errno otherwise.
102+ * @retval 0 on success, negative errno otherwise.
100103 */
101104int dfu_target_suit_reset (void );
102105
106+ /**
107+ * @brief Reboot the device, and apply new image.
108+ *
109+ * The reboot can be delayed by setting the
110+ * CONFIG_DFU_TARGET_REBOOT_RESET_DELAY_MS kconfig value.
111+ *
112+ * @retval 0 on success, negative errno otherwise.
113+ */
114+ int dfu_target_suit_reboot (void );
103115
104116#ifdef __cplusplus
105117}
0 commit comments