Apply ATOMIC macros in a number of other obvious places.
This commit is contained in:
parent
69da7c5b15
commit
47a5252230
9
clock.c
9
clock.c
|
|
@ -27,12 +27,9 @@ static void clock_250ms(void) {
|
||||||
power_off();
|
power_off();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
uint8_t save_reg = SREG;
|
ATOMIC_START
|
||||||
cli();
|
psu_timeout++;
|
||||||
CLI_SEI_BUG_MEMORY_BARRIER();
|
ATOMIC_END
|
||||||
psu_timeout++;
|
|
||||||
MEMORY_BARRIER();
|
|
||||||
SREG = save_reg;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
40
dda_queue.c
40
dda_queue.c
|
|
@ -113,18 +113,15 @@ void enqueue_home(TARGET *t, uint8_t endstop_check, uint8_t endstop_stop_cond) {
|
||||||
// make certain all writes to global memory
|
// make certain all writes to global memory
|
||||||
// are flushed before modifying mb_head.
|
// are flushed before modifying mb_head.
|
||||||
MEMORY_BARRIER();
|
MEMORY_BARRIER();
|
||||||
|
|
||||||
mb_head = h;
|
|
||||||
|
|
||||||
uint8_t save_reg = SREG;
|
|
||||||
cli();
|
|
||||||
CLI_SEI_BUG_MEMORY_BARRIER();
|
|
||||||
|
|
||||||
uint8_t isdead = (movebuffer[mb_tail].live == 0);
|
mb_head = h;
|
||||||
|
|
||||||
MEMORY_BARRIER();
|
uint8_t isdead;
|
||||||
SREG = save_reg;
|
|
||||||
|
ATOMIC_START
|
||||||
|
isdead = (movebuffer[mb_tail].live == 0);
|
||||||
|
ATOMIC_END
|
||||||
|
|
||||||
if (isdead) {
|
if (isdead) {
|
||||||
next_move();
|
next_move();
|
||||||
// Compensate for the cli() in setTimer().
|
// Compensate for the cli() in setTimer().
|
||||||
|
|
@ -173,19 +170,16 @@ void queue_flush() {
|
||||||
// Since the timer interrupt is disabled before this function
|
// Since the timer interrupt is disabled before this function
|
||||||
// is called it is not strictly necessary to write the variables
|
// is called it is not strictly necessary to write the variables
|
||||||
// inside an interrupt disabled block...
|
// inside an interrupt disabled block...
|
||||||
uint8_t save_reg = SREG;
|
ATOMIC_START
|
||||||
cli();
|
|
||||||
CLI_SEI_BUG_MEMORY_BARRIER();
|
|
||||||
|
|
||||||
// flush queue
|
|
||||||
mb_tail = mb_head;
|
|
||||||
movebuffer[mb_head].live = 0;
|
|
||||||
|
|
||||||
// disable timer
|
// flush queue
|
||||||
setTimer(0);
|
mb_tail = mb_head;
|
||||||
|
movebuffer[mb_head].live = 0;
|
||||||
MEMORY_BARRIER();
|
|
||||||
SREG = save_reg;
|
// disable timer
|
||||||
|
setTimer(0);
|
||||||
|
|
||||||
|
ATOMIC_END
|
||||||
}
|
}
|
||||||
|
|
||||||
/// wait for queue to empty
|
/// wait for queue to empty
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue