boot/boot_serial: Add boot_reset_request_hook to bs_reset
When hooks are enabled then boot_reset_request_hook will be called to check whether it is allowed to reset a device. Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
This commit is contained in:
parent
ad35e2b227
commit
b26fc487ee
|
@ -657,8 +657,19 @@ out:
|
||||||
static void
|
static void
|
||||||
bs_reset(char *buf, int len)
|
bs_reset(char *buf, int len)
|
||||||
{
|
{
|
||||||
bs_rc_rsp(0);
|
int rc = BOOT_HOOK_CALL(boot_reset_request_hook, 0, false);
|
||||||
|
if (rc == BOOT_RESET_REQUEST_HOOK_BUSY) {
|
||||||
|
rc = MGMT_ERR_EBUSY;
|
||||||
|
} else {
|
||||||
|
/* Currently whatever else is returned it is just converted
|
||||||
|
* to 0/no error. Boot serial starts accepting "force" parameter
|
||||||
|
* in command this needs to change.
|
||||||
|
*/
|
||||||
|
rc = 0;
|
||||||
|
}
|
||||||
|
bs_rc_rsp(rc);
|
||||||
|
|
||||||
|
if (rc == 0) {
|
||||||
#ifdef __ZEPHYR__
|
#ifdef __ZEPHYR__
|
||||||
#ifdef CONFIG_MULTITHREADING
|
#ifdef CONFIG_MULTITHREADING
|
||||||
k_sleep(K_MSEC(250));
|
k_sleep(K_MSEC(250));
|
||||||
|
@ -674,6 +685,7 @@ bs_reset(char *buf, int len)
|
||||||
hal_system_reset();
|
hal_system_reset();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse incoming line of input from console.
|
* Parse incoming line of input from console.
|
||||||
|
|
|
@ -41,6 +41,7 @@ extern "C" {
|
||||||
#define MGMT_ERR_ENOMEM 2
|
#define MGMT_ERR_ENOMEM 2
|
||||||
#define MGMT_ERR_EINVAL 3
|
#define MGMT_ERR_EINVAL 3
|
||||||
#define MGMT_ERR_ENOTSUP 8
|
#define MGMT_ERR_ENOTSUP 8
|
||||||
|
#define MGMT_ERR_EBUSY 10
|
||||||
|
|
||||||
#define NMGR_OP_READ 0
|
#define NMGR_OP_READ 0
|
||||||
#define NMGR_OP_WRITE 2
|
#define NMGR_OP_WRITE 2
|
||||||
|
|
Loading…
Reference in New Issue