@@ -155,7 +155,7 @@ int boot_request_clear(void)
155155 return retention_clear (bootloader_request_dev );
156156}
157157
158- int boot_request_confirm_slot (uint8_t image , uint32_t slot )
158+ int boot_request_confirm_slot (uint8_t image , enum boot_slot slot )
159159{
160160 uint8_t value = BOOT_REQUEST_SLOT_INVALID ;
161161 size_t req_entry ;
@@ -167,10 +167,10 @@ int boot_request_confirm_slot(uint8_t image, uint32_t slot)
167167 }
168168
169169 switch (slot ) {
170- case 0 :
170+ case BOOT_SLOT_PRIMARY :
171171 value = BOOT_REQUEST_SLOT_PRIMARY ;
172172 break ;
173- case 1 :
173+ case BOOT_SLOT_SECONDARY :
174174 value = BOOT_REQUEST_SLOT_SECONDARY ;
175175 break ;
176176 default :
@@ -181,7 +181,7 @@ int boot_request_confirm_slot(uint8_t image, uint32_t slot)
181181 sizeof (value ));
182182}
183183
184- bool boot_request_check_confirmed_slot (uint8_t image , uint32_t slot )
184+ bool boot_request_check_confirmed_slot (uint8_t image , enum boot_slot slot )
185185{
186186 uint8_t value = BOOT_REQUEST_SLOT_INVALID ;
187187 size_t req_entry ;
@@ -200,17 +200,17 @@ bool boot_request_check_confirmed_slot(uint8_t image, uint32_t slot)
200200
201201 switch (value ) {
202202 case BOOT_REQUEST_SLOT_PRIMARY :
203- return (slot == 0 );
203+ return (slot == BOOT_SLOT_PRIMARY );
204204 case BOOT_REQUEST_SLOT_SECONDARY :
205- return (slot == 1 );
205+ return (slot == BOOT_SLOT_SECONDARY );
206206 default :
207207 break ;
208208 }
209209
210210 return false;
211211}
212212
213- int boot_request_set_preferred_slot (uint8_t image , uint32_t slot )
213+ int boot_request_set_preferred_slot (uint8_t image , enum boot_slot slot )
214214{
215215 uint8_t value = BOOT_REQUEST_SLOT_INVALID ;
216216 size_t req_entry ;
@@ -222,10 +222,10 @@ int boot_request_set_preferred_slot(uint8_t image, uint32_t slot)
222222 }
223223
224224 switch (slot ) {
225- case 0 :
225+ case BOOT_SLOT_PRIMARY :
226226 value = BOOT_REQUEST_SLOT_PRIMARY ;
227227 break ;
228- case 1 :
228+ case BOOT_SLOT_SECONDARY :
229229 value = BOOT_REQUEST_SLOT_SECONDARY ;
230230 break ;
231231 default :
@@ -237,33 +237,33 @@ int boot_request_set_preferred_slot(uint8_t image, uint32_t slot)
237237}
238238
239239#ifdef CONFIG_FIND_NEXT_SLOT_HOOKS
240- uint32_t boot_request_get_preferred_slot (uint8_t image )
240+ enum boot_slot boot_request_get_preferred_slot (uint8_t image )
241241{
242242 uint8_t value = BOOT_REQUEST_SLOT_INVALID ;
243243 size_t req_entry ;
244244 int ret ;
245245
246246 ret = boot_request_entry_find (BOOT_REQUEST_IMG_PREFERENCE , image , & req_entry );
247247 if (ret != 0 ) {
248- return BOOT_REQUEST_NO_PREFERRED_SLOT ;
248+ return BOOT_SLOT_NONE ;
249249 }
250250
251251 ret = retention_read (bootloader_request_dev , req_entry * sizeof (value ), (void * )& value ,
252252 sizeof (value ));
253253 if (ret != 0 ) {
254- return BOOT_REQUEST_NO_PREFERRED_SLOT ;
254+ return BOOT_SLOT_NONE ;
255255 }
256256
257257 switch (value ) {
258258 case BOOT_REQUEST_SLOT_PRIMARY :
259- return 0 ;
259+ return BOOT_SLOT_PRIMARY ;
260260 case BOOT_REQUEST_SLOT_SECONDARY :
261- return 1 ;
261+ return BOOT_SLOT_SECONDARY ;
262262 default :
263263 break ;
264264 }
265265
266- return BOOT_REQUEST_NO_PREFERRED_SLOT ;
266+ return BOOT_SLOT_NONE ;
267267}
268268#endif /* CONFIG_FIND_NEXT_SLOT_HOOKS */
269269
0 commit comments