mirror of https://github.com/ArduPilot/ardupilot
SITL: implement cli()/sei() properly for desktop build
this disables simulated hardware interrupts during critical sections
This commit is contained in:
parent
c84d864cd6
commit
c9031f1d36
|
@ -6,7 +6,9 @@
|
||||||
#define ISR(vector,...) void vector(void); \
|
#define ISR(vector,...) void vector(void); \
|
||||||
void vector(void)
|
void vector(void)
|
||||||
|
|
||||||
#define cli()
|
extern "C" {
|
||||||
#define sei()
|
void cli(void);
|
||||||
|
void sei(void);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "avr/pgmspace.h"
|
#include "avr/pgmspace.h"
|
||||||
#include <BetterStream.h>
|
#include <BetterStream.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
#include <signal.h>
|
||||||
#include "desktop.h"
|
#include "desktop.h"
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -14,6 +15,24 @@ volatile uint8_t __iomem[1024];
|
||||||
unsigned __brkval = 0x2000;
|
unsigned __brkval = 0x2000;
|
||||||
unsigned __bss_end = 0x1000;
|
unsigned __bss_end = 0x1000;
|
||||||
|
|
||||||
|
// disable interrupts
|
||||||
|
void cli(void)
|
||||||
|
{
|
||||||
|
sigset_t set;
|
||||||
|
sigemptyset(&set);
|
||||||
|
sigaddset(&set, SIGALRM);
|
||||||
|
sigprocmask(SIG_BLOCK,&set,NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// enable interrupts
|
||||||
|
void sei(void)
|
||||||
|
{
|
||||||
|
sigset_t set;
|
||||||
|
sigemptyset(&set);
|
||||||
|
sigaddset(&set, SIGALRM);
|
||||||
|
sigprocmask(SIG_UNBLOCK,&set,NULL);
|
||||||
|
}
|
||||||
|
|
||||||
void pinMode(uint8_t pin, uint8_t mode)
|
void pinMode(uint8_t pin, uint8_t mode)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue