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:
@ -175,6 +175,11 @@ idle:
|
|||||||
cmp mode, #MODE_IDLE // if mode == IDLE: // 1
|
cmp mode, #MODE_IDLE // if mode == IDLE: // 1
|
||||||
beq idle // goto idle // 1 thru, 3 taken
|
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:
|
loop:
|
||||||
// The worst case timing is assumed to occur when reading the interrupt
|
// The worst case timing is assumed to occur when reading the interrupt
|
||||||
// status register *just* misses the flag being set - so we include the
|
// status register *just* misses the flag being set - so we include the
|
||||||
|
@ -301,8 +301,6 @@ void transceiver_startup(const transceiver_mode_t mode) {
|
|||||||
|
|
||||||
activate_best_clock_source();
|
activate_best_clock_source();
|
||||||
hw_sync_enable(_hw_sync_mode);
|
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(
|
usb_request_status_t usb_vendor_request_set_transceiver_mode(
|
||||||
|
Reference in New Issue
Block a user