Welcome to mirror list, hosted at ThFree Co, Russian Federation.

irq.h « simulator « src - github.com/Klipper3d/klipper.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 63f512908665fab0dc651cedb91833bff2403f9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef __SIMU_IRQ_H
#define __SIMU_IRQ_H
// Definitions for irq enable/disable on host simulator

#include <stdint.h>
#include "compiler.h" // barrier

extern uint8_t Interrupt_off;

static inline void irq_disable(void) {
    Interrupt_off = 1;
    barrier();
}

static inline void irq_enable(void) {
    barrier();
    Interrupt_off = 0;
}

static inline uint8_t irq_save(void) {
    uint8_t flag = Interrupt_off;
    irq_disable();
    return flag;
}

static inline void irq_restore(uint8_t flag) {
    barrier();
    Interrupt_off = flag;
}

#endif // irq.h