irq: Allow boards to define the return type of irq_save()
The AVR wants a uint8_t return type for irq_save(), but other architectures will generally prefer int. Allow the board to configure the size of the flag by introducing an irqstatus_t typedef. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
@@ -15,13 +15,15 @@ static inline void irq_enable(void) {
|
||||
sei();
|
||||
}
|
||||
|
||||
static inline uint8_t irq_save(void) {
|
||||
typedef uint8_t irqstatus_t;
|
||||
|
||||
static inline irqstatus_t irq_save(void) {
|
||||
uint8_t flag = SREG;
|
||||
irq_disable();
|
||||
return flag;
|
||||
}
|
||||
|
||||
static inline void irq_restore(uint8_t flag) {
|
||||
static inline void irq_restore(irqstatus_t flag) {
|
||||
barrier();
|
||||
SREG = flag;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user