@@ -155,7 +155,7 @@ int boot_request_clear(void)
155
155
return retention_clear (bootloader_request_dev );
156
156
}
157
157
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 )
159
159
{
160
160
uint8_t value = BOOT_REQUEST_SLOT_INVALID ;
161
161
size_t req_entry ;
@@ -167,10 +167,10 @@ int boot_request_confirm_slot(uint8_t image, uint32_t slot)
167
167
}
168
168
169
169
switch (slot ) {
170
- case 0 :
170
+ case BOOT_SLOT_PRIMARY :
171
171
value = BOOT_REQUEST_SLOT_PRIMARY ;
172
172
break ;
173
- case 1 :
173
+ case BOOT_SLOT_SECONDARY :
174
174
value = BOOT_REQUEST_SLOT_SECONDARY ;
175
175
break ;
176
176
default :
@@ -181,7 +181,7 @@ int boot_request_confirm_slot(uint8_t image, uint32_t slot)
181
181
sizeof (value ));
182
182
}
183
183
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 )
185
185
{
186
186
uint8_t value = BOOT_REQUEST_SLOT_INVALID ;
187
187
size_t req_entry ;
@@ -200,17 +200,17 @@ bool boot_request_check_confirmed_slot(uint8_t image, uint32_t slot)
200
200
201
201
switch (value ) {
202
202
case BOOT_REQUEST_SLOT_PRIMARY :
203
- return (slot == 0 );
203
+ return (slot == BOOT_SLOT_PRIMARY );
204
204
case BOOT_REQUEST_SLOT_SECONDARY :
205
- return (slot == 1 );
205
+ return (slot == BOOT_SLOT_SECONDARY );
206
206
default :
207
207
break ;
208
208
}
209
209
210
210
return false;
211
211
}
212
212
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 )
214
214
{
215
215
uint8_t value = BOOT_REQUEST_SLOT_INVALID ;
216
216
size_t req_entry ;
@@ -222,10 +222,10 @@ int boot_request_set_preferred_slot(uint8_t image, uint32_t slot)
222
222
}
223
223
224
224
switch (slot ) {
225
- case 0 :
225
+ case BOOT_SLOT_PRIMARY :
226
226
value = BOOT_REQUEST_SLOT_PRIMARY ;
227
227
break ;
228
- case 1 :
228
+ case BOOT_SLOT_SECONDARY :
229
229
value = BOOT_REQUEST_SLOT_SECONDARY ;
230
230
break ;
231
231
default :
@@ -237,33 +237,33 @@ int boot_request_set_preferred_slot(uint8_t image, uint32_t slot)
237
237
}
238
238
239
239
#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 )
241
241
{
242
242
uint8_t value = BOOT_REQUEST_SLOT_INVALID ;
243
243
size_t req_entry ;
244
244
int ret ;
245
245
246
246
ret = boot_request_entry_find (BOOT_REQUEST_IMG_PREFERENCE , image , & req_entry );
247
247
if (ret != 0 ) {
248
- return BOOT_REQUEST_NO_PREFERRED_SLOT ;
248
+ return BOOT_SLOT_NONE ;
249
249
}
250
250
251
251
ret = retention_read (bootloader_request_dev , req_entry * sizeof (value ), (void * )& value ,
252
252
sizeof (value ));
253
253
if (ret != 0 ) {
254
- return BOOT_REQUEST_NO_PREFERRED_SLOT ;
254
+ return BOOT_SLOT_NONE ;
255
255
}
256
256
257
257
switch (value ) {
258
258
case BOOT_REQUEST_SLOT_PRIMARY :
259
- return 0 ;
259
+ return BOOT_SLOT_PRIMARY ;
260
260
case BOOT_REQUEST_SLOT_SECONDARY :
261
- return 1 ;
261
+ return BOOT_SLOT_SECONDARY ;
262
262
default :
263
263
break ;
264
264
}
265
265
266
- return BOOT_REQUEST_NO_PREFERRED_SLOT ;
266
+ return BOOT_SLOT_NONE ;
267
267
}
268
268
#endif /* CONFIG_FIND_NEXT_SLOT_HOOKS */
269
269
0 commit comments