Move resetting of byte counts to the M0.

Previously, these counts were zeroed by the M4 when leaving the OFF
transceiver mode. Instead, do this on the M0 at the point where the M0
leaves IDLE mode.

This avoids a potential race in which the M4 zeroes the M0 count after
the M0 has already started incrementing it.
This commit is contained in:
Martin Ling
2021-12-24 08:39:47 +00:00
parent 3fd3c7786e
commit 0f3069ee5e
2 changed files with 5 additions and 2 deletions

View File

@ -175,6 +175,11 @@ idle:
cmp mode, #MODE_IDLE // if mode == IDLE: // 1
beq idle // goto idle // 1 thru, 3 taken
// Reset counts.
mov zero, #0 // zero = 0 // 1
str zero, [state, #M0_COUNT] // state.m0_count = zero // 2
str zero, [state, #M4_COUNT] // state.m4_count = zero // 2
loop:
// The worst case timing is assumed to occur when reading the interrupt
// status register *just* misses the flag being set - so we include the

View File

@ -301,8 +301,6 @@ void transceiver_startup(const transceiver_mode_t mode) {
activate_best_clock_source();
hw_sync_enable(_hw_sync_mode);
m0_state.m0_count = 0;
m0_state.m4_count = 0;
}
usb_request_status_t usb_vendor_request_set_transceiver_mode(