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); \
|
||||
void vector(void)
|
||||
|
||||
#define cli()
|
||||
#define sei()
|
||||
extern "C" {
|
||||
void cli(void);
|
||||
void sei(void);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "avr/pgmspace.h"
|
||||
#include <BetterStream.h>
|
||||
#include <sys/time.h>
|
||||
#include <signal.h>
|
||||
#include "desktop.h"
|
||||
|
||||
extern "C" {
|
||||
|
@ -14,6 +15,24 @@ volatile uint8_t __iomem[1024];
|
|||
unsigned __brkval = 0x2000;
|
||||
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)
|
||||
{
|
||||
|
||||
|
|
Loading…
Reference in New Issue