aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/ARM7-AT91SAM7S-FATFS-GCC/halconf.h2
-rw-r--r--demos/ARM7-AT91SAM7S-GCC/halconf.h2
-rw-r--r--demos/ARM7-AT91SAM7X-FATFS-GCC/halconf.h2
-rw-r--r--demos/ARM7-AT91SAM7X-GCC/halconf.h2
-rw-r--r--demos/ARM7-AT91SAM7X-LWIP-GCC/halconf.h2
-rw-r--r--demos/ARM7-AT91SAM7X-UIP-GCC/halconf.h2
-rw-r--r--demos/ARM7-LPC214x-FATFS-GCC/halconf.h2
-rw-r--r--demos/ARM7-LPC214x-G++/halconf.h2
-rw-r--r--demos/ARM7-LPC214x-GCC/halconf.h2
-rw-r--r--demos/ARMCM0-LPC1114-LPCXPRESSO/halconf.h2
-rw-r--r--demos/ARMCM3-LPC1343-LPCXPRESSO/halconf.h2
-rw-r--r--demos/AVR-AT90CANx-GCC/halconf.h2
-rw-r--r--demos/AVR-ATmega128-GCC/halconf.h2
-rw-r--r--demos/MSP430-MSP430x1611-GCC/halconf.h2
-rw-r--r--demos/PPC-SPC563-GCC/halconf.h2
-rw-r--r--demos/Posix-GCC/halconf.h2
-rw-r--r--demos/STM8L-STM8L152-DISCOVERY-STVD/demo/halconf.h2
-rw-r--r--demos/STM8S-STM8S105-DISCOVERY-STVD/demo/halconf.h2
-rw-r--r--demos/STM8S-STM8S208-RC/halconf.h2
-rw-r--r--demos/Win32-MinGW/halconf.h2
-rw-r--r--demos/Win32-MinGW/main.c2
-rw-r--r--os/hal/platforms/Posix/hal_lld.c12
-rw-r--r--os/hal/platforms/Posix/serial_lld.c26
-rw-r--r--os/hal/platforms/STM32F1xx/hal_lld.c1
-rw-r--r--os/hal/platforms/STM32F2xx/hal_lld.c1
-rw-r--r--os/hal/platforms/STM32F4xx/hal_lld.c1
-rw-r--r--os/hal/platforms/STM32L1xx/hal_lld.c15
-rw-r--r--os/hal/platforms/Win32/hal_lld.c12
-rw-r--r--os/hal/platforms/Win32/serial_lld.c26
-rw-r--r--os/ports/GCC/SIMIA32/chcore.c17
-rw-r--r--os/ports/GCC/SIMIA32/chcore.h11
-rw-r--r--testhal/LPC11xx/IRQ_STORM/halconf.h2
-rw-r--r--testhal/LPC13xx/IRQ_STORM/halconf.h2
-rw-r--r--testhal/STM8S/SPI/demo/halconf.h2
-rw-r--r--todo.txt8
35 files changed, 120 insertions, 58 deletions
diff --git a/demos/ARM7-AT91SAM7S-FATFS-GCC/halconf.h b/demos/ARM7-AT91SAM7S-FATFS-GCC/halconf.h
index 0189c3de8..e6c889afc 100644
--- a/demos/ARM7-AT91SAM7S-FATFS-GCC/halconf.h
+++ b/demos/ARM7-AT91SAM7S-FATFS-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/ARM7-AT91SAM7S-GCC/halconf.h b/demos/ARM7-AT91SAM7S-GCC/halconf.h
index 944627bb4..938dd46f3 100644
--- a/demos/ARM7-AT91SAM7S-GCC/halconf.h
+++ b/demos/ARM7-AT91SAM7S-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/ARM7-AT91SAM7X-FATFS-GCC/halconf.h b/demos/ARM7-AT91SAM7X-FATFS-GCC/halconf.h
index 0189c3de8..e6c889afc 100644
--- a/demos/ARM7-AT91SAM7X-FATFS-GCC/halconf.h
+++ b/demos/ARM7-AT91SAM7X-FATFS-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/ARM7-AT91SAM7X-GCC/halconf.h b/demos/ARM7-AT91SAM7X-GCC/halconf.h
index 944627bb4..938dd46f3 100644
--- a/demos/ARM7-AT91SAM7X-GCC/halconf.h
+++ b/demos/ARM7-AT91SAM7X-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/halconf.h b/demos/ARM7-AT91SAM7X-LWIP-GCC/halconf.h
index d29f031d9..ab1d8ca13 100644
--- a/demos/ARM7-AT91SAM7X-LWIP-GCC/halconf.h
+++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/ARM7-AT91SAM7X-UIP-GCC/halconf.h b/demos/ARM7-AT91SAM7X-UIP-GCC/halconf.h
index d29f031d9..ab1d8ca13 100644
--- a/demos/ARM7-AT91SAM7X-UIP-GCC/halconf.h
+++ b/demos/ARM7-AT91SAM7X-UIP-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/ARM7-LPC214x-FATFS-GCC/halconf.h b/demos/ARM7-LPC214x-FATFS-GCC/halconf.h
index 0189c3de8..e6c889afc 100644
--- a/demos/ARM7-LPC214x-FATFS-GCC/halconf.h
+++ b/demos/ARM7-LPC214x-FATFS-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/ARM7-LPC214x-G++/halconf.h b/demos/ARM7-LPC214x-G++/halconf.h
index 944627bb4..938dd46f3 100644
--- a/demos/ARM7-LPC214x-G++/halconf.h
+++ b/demos/ARM7-LPC214x-G++/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/ARM7-LPC214x-GCC/halconf.h b/demos/ARM7-LPC214x-GCC/halconf.h
index 944627bb4..938dd46f3 100644
--- a/demos/ARM7-LPC214x-GCC/halconf.h
+++ b/demos/ARM7-LPC214x-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/ARMCM0-LPC1114-LPCXPRESSO/halconf.h b/demos/ARMCM0-LPC1114-LPCXPRESSO/halconf.h
index a338e3485..3b48cdc02 100644
--- a/demos/ARMCM0-LPC1114-LPCXPRESSO/halconf.h
+++ b/demos/ARMCM0-LPC1114-LPCXPRESSO/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/ARMCM3-LPC1343-LPCXPRESSO/halconf.h b/demos/ARMCM3-LPC1343-LPCXPRESSO/halconf.h
index a338e3485..3b48cdc02 100644
--- a/demos/ARMCM3-LPC1343-LPCXPRESSO/halconf.h
+++ b/demos/ARMCM3-LPC1343-LPCXPRESSO/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/AVR-AT90CANx-GCC/halconf.h b/demos/AVR-AT90CANx-GCC/halconf.h
index 944627bb4..938dd46f3 100644
--- a/demos/AVR-AT90CANx-GCC/halconf.h
+++ b/demos/AVR-AT90CANx-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/AVR-ATmega128-GCC/halconf.h b/demos/AVR-ATmega128-GCC/halconf.h
index 944627bb4..938dd46f3 100644
--- a/demos/AVR-ATmega128-GCC/halconf.h
+++ b/demos/AVR-ATmega128-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/MSP430-MSP430x1611-GCC/halconf.h b/demos/MSP430-MSP430x1611-GCC/halconf.h
index 944627bb4..938dd46f3 100644
--- a/demos/MSP430-MSP430x1611-GCC/halconf.h
+++ b/demos/MSP430-MSP430x1611-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/PPC-SPC563-GCC/halconf.h b/demos/PPC-SPC563-GCC/halconf.h
index 68bc2405c..ed777ab57 100644
--- a/demos/PPC-SPC563-GCC/halconf.h
+++ b/demos/PPC-SPC563-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/Posix-GCC/halconf.h b/demos/Posix-GCC/halconf.h
index 5fc7a5215..2d6ea6061 100644
--- a/demos/Posix-GCC/halconf.h
+++ b/demos/Posix-GCC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/halconf.h b/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/halconf.h
index 944627bb4..938dd46f3 100644
--- a/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/halconf.h
+++ b/demos/STM8L-STM8L152-DISCOVERY-STVD/demo/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/STM8S-STM8S105-DISCOVERY-STVD/demo/halconf.h b/demos/STM8S-STM8S105-DISCOVERY-STVD/demo/halconf.h
index 944627bb4..938dd46f3 100644
--- a/demos/STM8S-STM8S105-DISCOVERY-STVD/demo/halconf.h
+++ b/demos/STM8S-STM8S105-DISCOVERY-STVD/demo/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/STM8S-STM8S208-RC/halconf.h b/demos/STM8S-STM8S208-RC/halconf.h
index 944627bb4..938dd46f3 100644
--- a/demos/STM8S-STM8S208-RC/halconf.h
+++ b/demos/STM8S-STM8S208-RC/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/Win32-MinGW/halconf.h b/demos/Win32-MinGW/halconf.h
index 5fc7a5215..2d6ea6061 100644
--- a/demos/Win32-MinGW/halconf.h
+++ b/demos/Win32-MinGW/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/demos/Win32-MinGW/main.c b/demos/Win32-MinGW/main.c
index d4cc554ce..61abfb093 100644
--- a/demos/Win32-MinGW/main.c
+++ b/demos/Win32-MinGW/main.c
@@ -61,7 +61,7 @@ static void cmd_threads(BaseChannel *chp, int argc, char *argv[]) {
tp = chRegFirstThread();
do {
chprintf(chp, "%.8lx %.8lx %4lu %4lu %9s %lu\r\n",
- (uint32_t)tp, (uint32_t)tp->p_ctx.r13,
+ (uint32_t)tp, (uint32_t)tp->p_ctx.esp,
(uint32_t)tp->p_prio, (uint32_t)(tp->p_refs - 1),
states[tp->p_state], (uint32_t)tp->p_time);
tp = chRegNextThread(tp);
diff --git a/os/hal/platforms/Posix/hal_lld.c b/os/hal/platforms/Posix/hal_lld.c
index 8b59d992b..8e1c34939 100644
--- a/os/hal/platforms/Posix/hal_lld.c
+++ b/os/hal/platforms/Posix/hal_lld.c
@@ -78,8 +78,10 @@ void ChkIntSources(void) {
#if HAL_USE_SERIAL
if (sd_lld_interrupt_pending()) {
+ dbg_check_lock();
if (chSchIsPreemptionRequired())
chSchDoReschedule();
+ dbg_check_unlock();
return;
}
#endif
@@ -87,9 +89,19 @@ void ChkIntSources(void) {
gettimeofday(&tv, NULL);
if (timercmp(&tv, &nextcnt, >=)) {
timeradd(&nextcnt, &tick, &nextcnt);
+
+ CH_IRQ_PROLOGUE();
+
+ chSysLockFromIsr();
chSysTimerHandlerI();
+ chSysUnlockFromIsr();
+
+ CH_IRQ_EPILOGUE();
+
+ dbg_check_lock();
if (chSchIsPreemptionRequired())
chSchDoReschedule();
+ dbg_check_unlock();
}
}
diff --git a/os/hal/platforms/Posix/serial_lld.c b/os/hal/platforms/Posix/serial_lld.c
index 31be73825..5bf22bc76 100644
--- a/os/hal/platforms/Posix/serial_lld.c
+++ b/os/hal/platforms/Posix/serial_lld.c
@@ -120,7 +120,9 @@ static bool_t connint(SerialDriver *sdp) {
printf("%s: Unable to setup non blocking mode on data socket\n", sdp->com_name);
goto abort;
}
+ chSysLockFromIsr();
chIOAddFlagsI(sdp, IO_CONNECTED);
+ chSysUnlockFromIsr();
return TRUE;
}
return FALSE;
@@ -146,7 +148,9 @@ static bool_t inint(SerialDriver *sdp) {
case 0:
close(sdp->com_data);
sdp->com_data = INVALID_SOCKET;
+ chSysLockFromIsr();
chIOAddFlagsI(sdp, IO_DISCONNECTED);
+ chSysUnlockFromIsr();
return FALSE;
case INVALID_SOCKET:
if (errno == EWOULDBLOCK)
@@ -155,8 +159,11 @@ static bool_t inint(SerialDriver *sdp) {
sdp->com_data = INVALID_SOCKET;
return FALSE;
}
- for (i = 0; i < n; i++)
+ for (i = 0; i < n; i++) {
+ chSysLockFromIsr();
sdIncomingDataI(sdp, data[i]);
+ chSysUnlockFromIsr();
+ }
return TRUE;
}
return FALSE;
@@ -171,7 +178,9 @@ static bool_t outint(SerialDriver *sdp) {
/*
* Input.
*/
+ chSysLockFromIsr();
n = sdRequestDataI(sdp);
+ chSysUnlockFromIsr();
if (n < 0)
return FALSE;
data[0] = (uint8_t)n;
@@ -180,7 +189,9 @@ static bool_t outint(SerialDriver *sdp) {
case 0:
close(sdp->com_data);
sdp->com_data = INVALID_SOCKET;
+ chSysLockFromIsr();
chIOAddFlagsI(sdp, IO_DISCONNECTED);
+ chSysUnlockFromIsr();
return FALSE;
case INVALID_SOCKET:
if (errno == EWOULDBLOCK)
@@ -256,10 +267,17 @@ void sd_lld_stop(SerialDriver *sdp) {
}
bool_t sd_lld_interrupt_pending(void) {
+ bool_t b;
+
+ CH_IRQ_PROLOGUE();
+
+ b = connint(&SD1) || connint(&SD2) ||
+ inint(&SD1) || inint(&SD2) ||
+ outint(&SD1) || outint(&SD2);
+
+ CH_IRQ_EPILOGUE();
- return connint(&SD1) || connint(&SD2) ||
- inint(&SD1) || inint(&SD2) ||
- outint(&SD1) || outint(&SD2);
+ return b;
}
#endif /* HAL_USE_SERIAL */
diff --git a/os/hal/platforms/STM32F1xx/hal_lld.c b/os/hal/platforms/STM32F1xx/hal_lld.c
index f5efeed5d..0112d7eaa 100644
--- a/os/hal/platforms/STM32F1xx/hal_lld.c
+++ b/os/hal/platforms/STM32F1xx/hal_lld.c
@@ -54,6 +54,7 @@ static void hal_lld_backup_domain_init(void) {
if ((RCC->BDCR & RCC_BDCR_LSEON) == 0) {
/* Backup domain reset.*/
RCC->BDCR = RCC_BDCR_BDRST;
+ RCC->BDCR = 0;
RCC->BDCR = RCC_BDCR_LSEON;
while ((RCC->BDCR & RCC_BDCR_LSERDY) == 0)
; /* Waits until LSE is stable. */
diff --git a/os/hal/platforms/STM32F2xx/hal_lld.c b/os/hal/platforms/STM32F2xx/hal_lld.c
index b9af01a92..7cc24f2a0 100644
--- a/os/hal/platforms/STM32F2xx/hal_lld.c
+++ b/os/hal/platforms/STM32F2xx/hal_lld.c
@@ -54,6 +54,7 @@ static void hal_lld_backup_domain_init(void) {
if ((RCC->BDCR & RCC_BDCR_LSEON) == 0) {
/* Backup domain reset.*/
RCC->BDCR = RCC_BDCR_BDRST;
+ RCC->BDCR = 0;
RCC->BDCR = RCC_BDCR_LSEON;
while ((RCC->BDCR & RCC_BDCR_LSERDY) == 0)
; /* Waits until LSE is stable. */
diff --git a/os/hal/platforms/STM32F4xx/hal_lld.c b/os/hal/platforms/STM32F4xx/hal_lld.c
index d26059d70..00c560f08 100644
--- a/os/hal/platforms/STM32F4xx/hal_lld.c
+++ b/os/hal/platforms/STM32F4xx/hal_lld.c
@@ -54,6 +54,7 @@ static void hal_lld_backup_domain_init(void) {
if ((RCC->BDCR & RCC_BDCR_LSEON) == 0) {
/* Backup domain reset.*/
RCC->BDCR = RCC_BDCR_BDRST;
+ RCC->BDCR = 0;
RCC->BDCR = RCC_BDCR_LSEON;
while ((RCC->BDCR & RCC_BDCR_LSERDY) == 0)
; /* Waits until LSE is stable. */
diff --git a/os/hal/platforms/STM32L1xx/hal_lld.c b/os/hal/platforms/STM32L1xx/hal_lld.c
index 01d61fbc2..4e1b385a3 100644
--- a/os/hal/platforms/STM32L1xx/hal_lld.c
+++ b/os/hal/platforms/STM32L1xx/hal_lld.c
@@ -51,11 +51,12 @@ static void hal_lld_backup_domain_init(void) {
/* If enabled then the LSE is started.*/
#if STM32_LSE_ENABLED
- if ((RCC->BDCR & RCC_BDCR_LSEON) == 0) {
+ if ((RCC->CSR & RCC_CSR_LSEON) == 0) {
/* Backup domain reset.*/
- RCC->BDCR = RCC_BDCR_BDRST;
- RCC->BDCR = RCC_BDCR_LSEON;
- while ((RCC->BDCR & RCC_BDCR_LSERDY) == 0)
+ RCC->CSR |= RCC_CSR_RTCRST;
+ RCC->CSR &= ~RCC_CSR_RTCRST;
+ RCC->CSR |= RCC_CSR_LSEON;
+ while ((RCC->CSR & RCC_CSR_LSERDY) == 0)
; /* Waits until LSE is stable. */
}
#endif
@@ -63,12 +64,12 @@ static void hal_lld_backup_domain_init(void) {
#if STM32_RTCSEL != STM32_RTCSEL_NOCLOCK
/* If the backup domain hasn't been initialized yet then proceed with
initialization.*/
- if ((RCC->BDCR & RCC_BDCR_RTCEN) == 0) {
+ if ((RCC->CSR & RCC_CSR_RTCEN) == 0) {
/* Selects clock source.*/
- RCC->BDCR = (RCC->BDCR & ~RCC_BDCR_RTCSEL) | STM32_RTCSEL;
+ RCC->CSR = (RCC->CSR & ~RCC_CSR_RTCSEL) | STM32_RTCSEL;
/* RTC clock enabled.*/
- RCC->BDCR |= RCC_BDCR_RTCEN;
+ RCC->CSR |= RCC_CSR_RTCEN;
}
#endif /* STM32_RTCSEL != STM32_RTCSEL_NOCLOCK */
diff --git a/os/hal/platforms/Win32/hal_lld.c b/os/hal/platforms/Win32/hal_lld.c
index 48d017f2f..183185c98 100644
--- a/os/hal/platforms/Win32/hal_lld.c
+++ b/os/hal/platforms/Win32/hal_lld.c
@@ -83,8 +83,10 @@ void ChkIntSources(void) {
#if HAL_USE_SERIAL
if (sd_lld_interrupt_pending()) {
+ dbg_check_lock();
if (chSchIsPreemptionRequired())
chSchDoReschedule();
+ dbg_check_unlock();
return;
}
#endif
@@ -93,9 +95,19 @@ void ChkIntSources(void) {
QueryPerformanceCounter(&n);
if (n.QuadPart > nextcnt.QuadPart) {
nextcnt.QuadPart += slice.QuadPart;
+
+ CH_IRQ_PROLOGUE();
+
+ chSysLockFromIsr();
chSysTimerHandlerI();
+ chSysUnlockFromIsr();
+
+ CH_IRQ_EPILOGUE();
+
+ dbg_check_lock();
if (chSchIsPreemptionRequired())
chSchDoReschedule();
+ dbg_check_unlock();
}
}
diff --git a/os/hal/platforms/Win32/serial_lld.c b/os/hal/platforms/Win32/serial_lld.c
index 6b76ebbc7..170067c4a 100644
--- a/os/hal/platforms/Win32/serial_lld.c
+++ b/os/hal/platforms/Win32/serial_lld.c
@@ -113,7 +113,9 @@ static bool_t connint(SerialDriver *sdp) {
printf("%s: Unable to setup non blocking mode on data socket\n", sdp->com_name);
goto abort;
}
+ chSysLockFromIsr();
chIOAddFlagsI(sdp, IO_CONNECTED);
+ chSysUnlockFromIsr();
return TRUE;
}
return FALSE;
@@ -140,7 +142,9 @@ static bool_t inint(SerialDriver *sdp) {
case 0:
closesocket(sdp->com_data);
sdp->com_data = INVALID_SOCKET;
+ chSysLockFromIsr();
chIOAddFlagsI(sdp, IO_DISCONNECTED);
+ chSysUnlockFromIsr();
return FALSE;
case SOCKET_ERROR:
if (WSAGetLastError() == WSAEWOULDBLOCK)
@@ -149,8 +153,11 @@ static bool_t inint(SerialDriver *sdp) {
sdp->com_data = INVALID_SOCKET;
return FALSE;
}
- for (i = 0; i < n; i++)
+ for (i = 0; i < n; i++) {
+ chSysLockFromIsr();
sdIncomingDataI(sdp, data[i]);
+ chSysUnlockFromIsr();
+ }
return TRUE;
}
return FALSE;
@@ -165,7 +172,9 @@ static bool_t outint(SerialDriver *sdp) {
/*
* Input.
*/
+ chSysLockFromIsr();
n = sdRequestDataI(sdp);
+ chSysUnlockFromIsr();
if (n < 0)
return FALSE;
data[0] = (uint8_t)n;
@@ -174,7 +183,9 @@ static bool_t outint(SerialDriver *sdp) {
case 0:
closesocket(sdp->com_data);
sdp->com_data = INVALID_SOCKET;
+ chSysLockFromIsr();
chIOAddFlagsI(sdp, IO_DISCONNECTED);
+ chSysUnlockFromIsr();
return FALSE;
case SOCKET_ERROR:
if (WSAGetLastError() == WSAEWOULDBLOCK)
@@ -253,10 +264,17 @@ void sd_lld_stop(SerialDriver *sdp) {
}
bool_t sd_lld_interrupt_pending(void) {
+ bool_t b;
+
+ CH_IRQ_PROLOGUE();
+
+ b = connint(&SD1) || connint(&SD2) ||
+ inint(&SD1) || inint(&SD2) ||
+ outint(&SD1) || outint(&SD2);
+
+ CH_IRQ_EPILOGUE();
- return connint(&SD1) || connint(&SD2) ||
- inint(&SD1) || inint(&SD2) ||
- outint(&SD1) || outint(&SD2);
+ return b;
}
#endif /* HAL_USE_SERIAL */
diff --git a/os/ports/GCC/SIMIA32/chcore.c b/os/ports/GCC/SIMIA32/chcore.c
index 58f079ef5..fff2b22c4 100644
--- a/os/ports/GCC/SIMIA32/chcore.c
+++ b/os/ports/GCC/SIMIA32/chcore.c
@@ -69,17 +69,16 @@ void port_halt(void) {
}
/**
- * Threads return point, it just invokes @p chThdExit().
+ * @brief Start a thread by invoking its work function.
+ * @details If the work function returns @p chThdExit() is automatically
+ * invoked.
*/
-void threadexit(void) {
+__attribute__((cdecl, noreturn))
+void _port_thread_start(msg_t (*pf)(void *), void *p) {
-#if defined(WIN32) || defined (__APPLE__)
- asm volatile ("push %eax \n\t" \
- "call _chThdExit");
-#else
- asm volatile ("push %eax \n\t" \
- "call chThdExit");
-#endif
+ chSysUnlock();
+ chThdExit(pf(p));
+ while(1);
}
/** @} */
diff --git a/os/ports/GCC/SIMIA32/chcore.h b/os/ports/GCC/SIMIA32/chcore.h
index 8bfa719f8..636ae3886 100644
--- a/os/ports/GCC/SIMIA32/chcore.h
+++ b/os/ports/GCC/SIMIA32/chcore.h
@@ -105,13 +105,11 @@ struct context {
*/
#define SETUP_CONTEXT(workspace, wsize, pf, arg) { \
uint8_t *esp = (uint8_t *)workspace + wsize; \
- APUSH(esp, 0); \
- APUSH(esp, 0); \
- APUSH(esp, 0); \
APUSH(esp, arg); \
- APUSH(esp, threadexit); \
+ APUSH(esp, pf); \
+ APUSH(esp, 0); \
esp -= sizeof(struct intctx); \
- ((struct intctx *)esp)->eip = pf; \
+ ((struct intctx *)esp)->eip = _port_thread_start; \
((struct intctx *)esp)->ebx = 0; \
((struct intctx *)esp)->edi = 0; \
((struct intctx *)esp)->esi = 0; \
@@ -224,7 +222,8 @@ extern "C" {
#endif
__attribute__((fastcall)) void port_switch(Thread *ntp, Thread *otp);
__attribute__((fastcall)) void port_halt(void);
- void threadexit(void);
+ __attribute__((cdecl, noreturn)) void _port_thread_start(msg_t (*pf)(void *),
+ void *p);
void ChkIntSources(void);
#ifdef __cplusplus
}
diff --git a/testhal/LPC11xx/IRQ_STORM/halconf.h b/testhal/LPC11xx/IRQ_STORM/halconf.h
index 944627bb4..938dd46f3 100644
--- a/testhal/LPC11xx/IRQ_STORM/halconf.h
+++ b/testhal/LPC11xx/IRQ_STORM/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/testhal/LPC13xx/IRQ_STORM/halconf.h b/testhal/LPC13xx/IRQ_STORM/halconf.h
index df586a1df..43da5f38d 100644
--- a/testhal/LPC13xx/IRQ_STORM/halconf.h
+++ b/testhal/LPC13xx/IRQ_STORM/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/testhal/STM8S/SPI/demo/halconf.h b/testhal/STM8S/SPI/demo/halconf.h
index 1083c2291..4cbc7b3cc 100644
--- a/testhal/STM8S/SPI/demo/halconf.h
+++ b/testhal/STM8S/SPI/demo/halconf.h
@@ -38,7 +38,7 @@
* @brief Enables the TM subsystem.
*/
#if !defined(HAL_USE_TM) || defined(__DOXYGEN__)
-#define HAL_USE_TM TRUE
+#define HAL_USE_TM FALSE
#endif
/**
diff --git a/todo.txt b/todo.txt
index b91ebd51c..c1325f5f7 100644
--- a/todo.txt
+++ b/todo.txt
@@ -8,11 +8,11 @@ N = Decided against.
Current Pipeline (2.3.x):
* I2C device driver class support and at least one implementation.
* Consistency check of all halconf.h files.
-X STM32F2xx validation (so far done testing on STM32F4).
-X Revision of the RTCv1 driver implementation.
+* Consistency check of all STM32xx mcuconf.h files.
+* Revision of the RTCv1 driver implementation.
+* Fixing issue with Simulator and CH_DBG_SYSTEM_STATE_CHECK option.
+X STM32F2 validation (so far done testing on STM32F4).
X Revision of the RTCv2 driver implementation.
-- Consistency check of all STM32xx mcuconf.h files.
-- Fixing issue with Simulator and CH_DBG_SYSTEM_STATE_CHECK option.
- SDC driver port to STM32F2 and STM32F4.
- CAN driver test on STM32F4.