mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-19 20:57:55 -06:00
Initial commit of source code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
37a91e9c10
commit
f582a36e4d
71 changed files with 9950 additions and 0 deletions
29
src/avr/irq.h
Normal file
29
src/avr/irq.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
#ifndef __AVR_IRQ_H
|
||||
#define __AVR_IRQ_H
|
||||
// Definitions for irq enable/disable on AVR
|
||||
|
||||
#include <avr/interrupt.h> // cli
|
||||
#include "compiler.h" // barrier
|
||||
|
||||
static inline void irq_disable(void) {
|
||||
cli();
|
||||
barrier();
|
||||
}
|
||||
|
||||
static inline void irq_enable(void) {
|
||||
barrier();
|
||||
sei();
|
||||
}
|
||||
|
||||
static inline uint8_t irq_save(void) {
|
||||
uint8_t flag = SREG;
|
||||
irq_disable();
|
||||
return flag;
|
||||
}
|
||||
|
||||
static inline void irq_restore(uint8_t flag) {
|
||||
barrier();
|
||||
SREG = flag;
|
||||
}
|
||||
|
||||
#endif // irq.h
|
Loading…
Add table
Add a link
Reference in a new issue