aboutsummaryrefslogtreecommitdiffstats
path: root/os/ports/GCC
diff options
context:
space:
mode:
Diffstat (limited to 'os/ports/GCC')
-rw-r--r--os/ports/GCC/ARMCMx/chcore_v6m.h17
-rw-r--r--os/ports/GCC/ARMCMx/chcore_v7m.c2
-rw-r--r--os/ports/GCC/ARMCMx/chcore_v7m.h17
3 files changed, 35 insertions, 1 deletions
diff --git a/os/ports/GCC/ARMCMx/chcore_v6m.h b/os/ports/GCC/ARMCMx/chcore_v6m.h
index 0997ddeea..34d1ee911 100644
--- a/os/ports/GCC/ARMCMx/chcore_v6m.h
+++ b/os/ports/GCC/ARMCMx/chcore_v6m.h
@@ -349,6 +349,23 @@ struct context {
}
#endif
+/**
+ * @brief Excludes the default @p chSchIsPreemptionRequired()implementation.
+ */
+#define PORT_OPTIMIZED_ISPREEMPTIONREQUIRED
+
+#if (CH_TIME_QUANTUM > 0) || defined(__DOXYGEN__)
+/**
+ * @brief Inlineable version of this kernel function.
+ */
+#define chSchIsPreemptionRequired() \
+ (rlist.r_preempt ? firstprio(&rlist.r_queue) > currp->p_prio : \
+ firstprio(&rlist.r_queue) >= currp->p_prio)
+#else /* CH_TIME_QUANTUM == 0 */
+#define chSchIsPreemptionRequired() \
+ (firstprio(&rlist.r_queue) > currp->p_prio)
+#endif /* CH_TIME_QUANTUM == 0 */
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/os/ports/GCC/ARMCMx/chcore_v7m.c b/os/ports/GCC/ARMCMx/chcore_v7m.c
index 437492c90..30ba9c220 100644
--- a/os/ports/GCC/ARMCMx/chcore_v7m.c
+++ b/os/ports/GCC/ARMCMx/chcore_v7m.c
@@ -163,7 +163,7 @@ void _port_unlock(void) {
void _port_irq_epilogue(void) {
port_lock_from_isr();
- if ((SCB_ICSR & ICSR_RETTOBASE)) {
+ if ((SCB_ICSR & ICSR_RETTOBASE) != 0) {
struct extctx *ctxp;
/* Current PSP value.*/
diff --git a/os/ports/GCC/ARMCMx/chcore_v7m.h b/os/ports/GCC/ARMCMx/chcore_v7m.h
index 86b49a095..7fd763a7d 100644
--- a/os/ports/GCC/ARMCMx/chcore_v7m.h
+++ b/os/ports/GCC/ARMCMx/chcore_v7m.h
@@ -486,6 +486,23 @@ struct context {
}
#endif
+/**
+ * @brief Excludes the default @p chSchIsPreemptionRequired()implementation.
+ */
+#define PORT_OPTIMIZED_ISPREEMPTIONREQUIRED
+
+#if (CH_TIME_QUANTUM > 0) || defined(__DOXYGEN__)
+/**
+ * @brief Inlineable version of this kernel function.
+ */
+#define chSchIsPreemptionRequired() \
+ (rlist.r_preempt ? firstprio(&rlist.r_queue) > currp->p_prio : \
+ firstprio(&rlist.r_queue) >= currp->p_prio)
+#else /* CH_TIME_QUANTUM == 0 */
+#define chSchIsPreemptionRequired() \
+ (firstprio(&rlist.r_queue) > currp->p_prio)
+#endif /* CH_TIME_QUANTUM == 0 */
+
#ifdef __cplusplus
extern "C" {
#endif