Fixed potential crash.

board_button_read() disables interrupts and cannot be parallelized when flash is being used. It is imperative that core1 must not use flash during the board_button_read(). Since it is not feasible to put mutexes in *every* flash memory read/write in core1, it is preferable to wait until core1 finishes command execution.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2023-10-31 00:40:38 +01:00
parent 4f0925420b
commit 3182d1e2e6
3 changed files with 3 additions and 3 deletions

View File

@@ -280,7 +280,6 @@ void usb_task() {
// printf("\r\n ------ M = %lu\r\n",m);
if (has_m) {
if (m == EV_EXEC_FINISHED) {
timeout_stop();
#ifdef USB_ITF_HID
if (itf == ITF_HID) {
driver_exec_finished_hid(finished_data_size);
@@ -293,6 +292,7 @@ void usb_task() {
#endif
led_set_blink(BLINK_MOUNTED);
card_locked_itf = ITF_TOTAL;
timeout_stop();
}
else if (m == EV_PRESS_BUTTON) {
uint32_t flag = wait_button() ? EV_BUTTON_TIMEOUT : EV_BUTTON_PRESSED;