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