aboutsummaryrefslogtreecommitdiffstats
path: root/os
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-03-17 10:32:12 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-03-17 10:32:12 +0000
commit43433fde0bd127e7857379a2799f538b71796287 (patch)
tree06ba9a664a3ae35259388c97e256ea823f222231 /os
parent52b961258008124cecb3f6f62f8c1aa7b608de12 (diff)
downloadChibiOS-43433fde0bd127e7857379a2799f538b71796287.tar.gz
ChibiOS-43433fde0bd127e7857379a2799f538b71796287.tar.bz2
ChibiOS-43433fde0bd127e7857379a2799f538b71796287.zip
Improvements to simulator IRQ detection.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11792 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os')
-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();