@@ -27,37 +27,7 @@ extern "C" {
2727#endif
2828
2929/**
30- * @brief Ensures the spare slot (slot 1) is fully erased.
31- *
32- * @param slot A slot to erase.
33- *
34- * @return 0 on success, MGMT_ERR_[...] code on failure.
35- */
36- int img_mgmt_erase_slot (int slot );
37-
38- /**
39- * @brief Marks the image in the specified slot as pending. On the next reboot,
40- * the system will perform a boot of the specified image.
41- *
42- * @param slot The slot to mark as pending. In the typical use case, this is 1.
43- * @param permanent Whether the image should be used permanently or only tested once:
44- * 0=run image once, then confirm or revert.
45- * 1=run image forever.
46- *
47- * @return 0 on success, MGMT_ERR_[...] code on failure.
48- */
49- int img_mgmt_write_pending (int slot , bool permanent );
50-
51- /**
52- * @brief Marks the image in slot 0 as confirmed. The system will continue
53- * booting into the image in slot 0 until told to boot from a different slot.
54- *
55- * @return 0 on success, MGMT_ERR_[...] code on failure.
56- */
57- int img_mgmt_write_confirmed (void );
58-
59- /**
60- * @brief Reads the specified chunk of data from an image slot.
30+ * @brief Read the specified chunk of data from an image slot.
6131 *
6232 * @param slot The index of the slot to read from.
6333 * @param offset The offset within the slot to read from.
@@ -69,7 +39,7 @@ int img_mgmt_write_confirmed(void);
6939int img_mgmt_read (int slot , unsigned int offset , void * dst , unsigned int num_bytes );
7040
7141/**
72- * @brief Writes the specified chunk of image data to slot 1.
42+ * @brief Write the specified chunk of image data to slot 1.
7343 *
7444 * @param offset The offset within slot 1 to write to.
7545 * @param data The image data to write.
@@ -84,35 +54,9 @@ int img_mgmt_write_image_data(unsigned int offset, const void *data, unsigned in
8454 bool last );
8555
8656/**
87- * @brief Indicates the type of swap operation that will occur on the next
88- * reboot, if any, between provided slot and it's pair.
89- * Querying any slots of the same pair will give the same result.
90- *
91- * @param slot An slot number;
92- *
93- * @return An IMG_MGMT_SWAP_TYPE_[...] code.
94- */
95- int img_mgmt_swap_type (int slot );
96-
97- /**
98- * @brief Returns image that the given slot belongs to.
57+ * @brief Get the slot number of an alternate (inactive) image pair.
9958 *
100- * @param slot A slot number.
101- *
102- * @return 0 based image number.
103- */
104- static inline int img_mgmt_slot_to_image (int slot )
105- {
106- __ASSERT (slot >= 0 && slot < (CONFIG_MCUMGR_GRP_IMG_UPDATABLE_IMAGE_NUMBER << 1 ),
107- "Impossible slot number" );
108-
109- return (slot >> 1 );
110- }
111-
112- /**
113- * @brief Get slot number of alternate (inactive) image pair
114- *
115- * @param slot A slot number.
59+ * @param slot A slot number.
11660 *
11761 * @return Number of other slot in pair
11862 */
@@ -137,27 +81,27 @@ enum img_mgmt_next_boot_type {
13781};
13882
13983/**
140- * @brief Get next boot slot number for a given image.
84+ * @brief Get the next boot slot number for a given image.
14185 *
14286 * @param image An image number.
143- * @param type Type of next boot
87+ * @param type Type of next boot.
14488 *
14589 * @return Number of slot, from pair of slots assigned to image, that will
146- * boot on next reset. User needs to compare this slot against active slot
147- * to check whether application image will change for the next boot.
148- * @return -1 in case when next boot slot can not be established.
90+ * boot on next reset. You need to compare this slot against an active slot
91+ * to check whether the application image will change for the next boot.
92+ * @return -1 if the next boot slot cannot be established.
14993 */
15094int img_mgmt_get_next_boot_slot (int image , enum img_mgmt_next_boot_type * type );
15195
15296/**
153- * Collects information about the specified image slot.
97+ * Collect information about the specified image slot.
15498 *
15599 * @return Flags of the specified image slot
156100 */
157101uint8_t img_mgmt_state_flags (int query_slot );
158102
159103/**
160- * Erases image data at given offset
104+ * Erase the image data at given offset.
161105 *
162106 * @param offset The offset within slot 1 to erase at.
163107 * @param num_bytes The number of bytes to erase.
@@ -167,24 +111,9 @@ uint8_t img_mgmt_state_flags(int query_slot);
167111int img_mgmt_erase_image_data (unsigned int off , unsigned int num_bytes );
168112
169113/**
170- * Erases a flash sector as image upload crosses a sector boundary.
171- * Erasing the entire flash size at one time can take significant time,
172- * causing a bluetooth disconnect or significant battery sag.
173- * Instead we will erase immediately prior to crossing a sector.
174- * We could check for empty to increase efficiency, but instead we always erase
175- * for consistency and simplicity.
176- *
177- * @param off Offset that is about to be written
178- * @param len Number of bytes to be written
179- *
180- * @return 0 if success ERROR_CODE if could not erase sector
181- */
182- int img_mgmt_erase_if_needed (uint32_t off , uint32_t len );
183-
184- /**
185- * Verifies an upload request and indicates the actions that should be taken
114+ * Verifies an upload request and indicates the actions to be taken
186115 * during processing of the request. This is a "read only" function in the
187- * sense that it doesn't write anything to flash and doesn't modify any global
116+ * sense that it does not write anything to flash or modify any global
188117 * variables.
189118 *
190119 * @param req The upload request to inspect.
@@ -197,26 +126,9 @@ int img_mgmt_erase_if_needed(uint32_t off, uint32_t len);
197126int img_mgmt_upload_inspect (const struct img_mgmt_upload_req * req ,
198127 struct img_mgmt_upload_action * action );
199128
200- /**
201- * @brief Takes the image management lock (if enabled) to prevent other
202- * threads interfering with an ongoing operation.
203- */
204- void img_mgmt_take_lock (void );
205-
206- /**
207- * @brief Releases the held image management lock (if enabled) to allow
208- * other threads to use image management operations.
209- */
210- void img_mgmt_release_lock (void );
211-
212129#define ERASED_VAL_32 (x ) (((x) << 24) | ((x) << 16) | ((x) << 8) | (x))
213- int img_mgmt_erased_val (int slot , uint8_t * erased_val );
214130
215- int img_mgmt_find_by_hash (uint8_t * find , struct image_version * ver );
216- int img_mgmt_find_by_ver (struct image_version * find , uint8_t * hash );
217131int img_mgmt_state_read (struct smp_streamer * ctxt );
218- int img_mgmt_state_write (struct smp_streamer * njb );
219- int img_mgmt_flash_area_id (int slot );
220132
221133#ifdef __cplusplus
222134}
0 commit comments