Browse Source

HAL_ChibiOS: added IRQ save/restore to hal.scheduler

these are used by RPM driver
master
Andrew Tridgell 7 years ago
parent
commit
51c40a013b
  1. 18
      libraries/AP_HAL_ChibiOS/Scheduler.cpp
  2. 12
      libraries/AP_HAL_ChibiOS/Scheduler.h

18
libraries/AP_HAL_ChibiOS/Scheduler.cpp

@ -416,4 +416,22 @@ void Scheduler::system_initialized() @@ -416,4 +416,22 @@ void Scheduler::system_initialized()
_initialized = true;
}
/*
disable interrupts and return a context that can be used to
restore the interrupt state. This can be used to protect
critical regions
*/
void *Scheduler::disable_interrupts_save(void)
{
return (void *)(uintptr_t)chSysGetStatusAndLockX();
}
/*
restore interrupt state from disable_interrupts_save()
*/
void Scheduler::restore_interrupts(void *state)
{
chSysRestoreStatusX((syssts_t)(uintptr_t)state);
}
#endif

12
libraries/AP_HAL_ChibiOS/Scheduler.h

@ -75,6 +75,18 @@ public: @@ -75,6 +75,18 @@ public:
void hal_initialized() { _hal_initialized = true; }
bool check_called_boost(void);
/*
disable interrupts and return a context that can be used to
restore the interrupt state. This can be used to protect
critical regions
*/
void *disable_interrupts_save(void) override;
/*
restore interrupt state from disable_interrupts_save()
*/
void restore_interrupts(void *) override;
private:
bool _initialized;

Loading…
Cancel
Save