aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/simulator
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports/simulator')
-rwxr-xr-xos/hal/ports/simulator/posix/hal_lld.c10
-rw-r--r--os/hal/ports/simulator/win32/hal_lld.c10
2 files changed, 10 insertions, 10 deletions
diff --git a/os/hal/ports/simulator/posix/hal_lld.c b/os/hal/ports/simulator/posix/hal_lld.c
index 041986092..449fd8e98 100755
--- a/os/hal/ports/simulator/posix/hal_lld.c
+++ b/os/hal/ports/simulator/posix/hal_lld.c
@@ -70,19 +70,17 @@ void hal_lld_init(void) {
*/
void _sim_check_for_interrupts(void) {
struct timeval tv;
+ bool int_occurred = false;
#if HAL_USE_SERIAL
if (sd_lld_interrupt_pending()) {
- _dbg_check_lock();
- if (chSchIsPreemptionRequired())
- chSchDoReschedule();
- _dbg_check_unlock();
- return;
+ int_occured = true;
}
#endif
gettimeofday(&tv, NULL);
if (timercmp(&tv, &nextcnt, >=)) {
+ int_occurred = true;
timeradd(&nextcnt, &tick, &nextcnt);
CH_IRQ_PROLOGUE();
@@ -92,7 +90,9 @@ void _sim_check_for_interrupts(void) {
chSysUnlockFromISR();
CH_IRQ_EPILOGUE();
+ }
+ if (int_occurred) {
_dbg_check_lock();
if (chSchIsPreemptionRequired())
chSchDoReschedule();
diff --git a/os/hal/ports/simulator/win32/hal_lld.c b/os/hal/ports/simulator/win32/hal_lld.c
index 624ec5f4d..e00aab428 100644
--- a/os/hal/ports/simulator/win32/hal_lld.c
+++ b/os/hal/ports/simulator/win32/hal_lld.c
@@ -76,20 +76,18 @@ void hal_lld_init(void) {
*/
void _sim_check_for_interrupts(void) {
LARGE_INTEGER n;
+ bool int_occurred = false;
#if HAL_USE_SERIAL
if (sd_lld_interrupt_pending()) {
- _dbg_check_lock();
- if (chSchIsPreemptionRequired())
- chSchDoReschedule();
- _dbg_check_unlock();
- return;
+ int_occured = true;
}
#endif
/* Interrupt Timer simulation (10ms interval).*/
QueryPerformanceCounter(&n);
if (n.QuadPart > nextcnt.QuadPart) {
+ int_occured = true;
nextcnt.QuadPart += slice.QuadPart;
CH_IRQ_PROLOGUE();
@@ -99,7 +97,9 @@ void _sim_check_for_interrupts(void) {
chSysUnlockFromISR();
CH_IRQ_EPILOGUE();
+ }
+ if (int_occurred) {
_dbg_check_lock();
if (chSchIsPreemptionRequired())
chSchDoReschedule();