mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-21 21:58:05 -06:00
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:
parent
9dd101c26f
commit
fa85094cbb
8 changed files with 33 additions and 25 deletions
|
@ -16,28 +16,32 @@
|
|||
* Interrupts
|
||||
****************************************************************/
|
||||
|
||||
uint8_t Interrupt_off;
|
||||
irqstatus_t Interrupt_off;
|
||||
|
||||
void irq_disable(void)
|
||||
void
|
||||
irq_disable(void)
|
||||
{
|
||||
Interrupt_off = 1;
|
||||
barrier();
|
||||
}
|
||||
|
||||
void irq_enable(void)
|
||||
void
|
||||
irq_enable(void)
|
||||
{
|
||||
barrier();
|
||||
Interrupt_off = 0;
|
||||
}
|
||||
|
||||
uint8_t irq_save(void)
|
||||
irqstatus_t
|
||||
irq_save(void)
|
||||
{
|
||||
uint8_t flag = Interrupt_off;
|
||||
irqstatus_t flag = Interrupt_off;
|
||||
irq_disable();
|
||||
return flag;
|
||||
}
|
||||
|
||||
void irq_restore(uint8_t flag)
|
||||
void
|
||||
irq_restore(irqstatus_t flag)
|
||||
{
|
||||
barrier();
|
||||
Interrupt_off = flag;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue