diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-03-27 09:51:45 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2015-03-27 09:51:45 +0000 |
commit | 25c944f87f69c46efe23e998152c9c48365e51b0 (patch) | |
tree | 5ca6c4694122ba4996c812394cf45809b097ac12 /os/rt | |
parent | 6cc7199329fa18b0f2a2110c686b71c2d5ea556e (diff) | |
download | ChibiOS-25c944f87f69c46efe23e998152c9c48365e51b0.tar.gz ChibiOS-25c944f87f69c46efe23e998152c9c48365e51b0.tar.bz2 ChibiOS-25c944f87f69c46efe23e998152c9c48365e51b0.zip |
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7816 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/rt')
-rw-r--r-- | os/rt/include/chsys.h | 36 | ||||
-rw-r--r-- | os/rt/ports/ARMCMx/chcore.h | 16 | ||||
-rw-r--r-- | os/rt/ports/ARMCMx/chcore_v7m.h | 2 | ||||
-rw-r--r-- | os/rt/templates/chcore.h | 10 |
4 files changed, 55 insertions, 9 deletions
diff --git a/os/rt/include/chsys.h b/os/rt/include/chsys.h index 888e98b5c..9d1bff204 100644 --- a/os/rt/include/chsys.h +++ b/os/rt/include/chsys.h @@ -64,6 +64,42 @@ * @name ISRs abstraction macros
*/
/**
+ * @brief Priority level validation macro.
+ * @details This macro determines if the passed value is a valid priority
+ * level for the underlying architecture.
+ *
+ * @param[in] prio the priority level
+ * @return Priority range result.
+ * @false if the priority is invalid or if the architecture
+ * does not support priorities.
+ * @true if the priority is valid.
+ */
+#if defined(PORT_IRQ_IS_VALID_PRIORITY) || defined(__DOXYGEN__)
+#define CH_IRQ_IS_VALID_PRIORITY(prio) \
+ PORT_IRQ_IS_VALID_PRIORITY(prio)
+#else
+#define CH_IRQ_IS_VALID_PRIORITY(prio) false
+#endif
+
+/**
+ * @brief Priority level validation macro.
+ * @details This macro determines if the passed value is a valid priority
+ * level that cannot preempt the kernel critical zone.
+ *
+ * @param[in] prio the priority level
+ * @return Priority range result.
+ * @false if the priority is invalid or if the architecture
+ * does not support priorities.
+ * @true if the priority is valid.
+ */
+#if defined(PORT_IRQ_IS_VALID_KERNEL_PRIORITY) || defined(__DOXYGEN__)
+#define CH_IRQ_IS_VALID_KERNEL_PRIORITY(prio) \
+ PORT_IRQ_IS_VALID_KERNEL_PRIORITY(prio)
+#else
+#define CH_IRQ_IS_VALID_KERNEL_PRIORITY(prio) false
+#endif
+
+/**
* @brief IRQ handler enter code.
* @note Usually IRQ handlers functions are also declared naked.
* @note On some architectures this macro can be empty.
diff --git a/os/rt/ports/ARMCMx/chcore.h b/os/rt/ports/ARMCMx/chcore.h index abf0b4596..11d14234e 100644 --- a/os/rt/ports/ARMCMx/chcore.h +++ b/os/rt/ports/ARMCMx/chcore.h @@ -163,22 +163,22 @@ struct context { #define CORTEX_MAXIMUM_PRIORITY 0U
/**
- * @brief Priority level verification macro.
+ * @brief Priority level to priority mask conversion macro.
*/
-#define CORTEX_IS_VALID_PRIORITY(n) \
- (((n) >= 0) && ((n) < CORTEX_PRIORITY_LEVELS))
+#define CORTEX_PRIO_MASK(n) \
+ ((n) << (8U - (unsigned)CORTEX_PRIORITY_BITS))
/**
* @brief Priority level verification macro.
*/
-#define CORTEX_IS_VALID_KERNEL_PRIORITY(n) \
- (((n) >= CORTEX_MAX_KERNEL_PRIORITY) && ((n) < CORTEX_PRIORITY_LEVELS))
+#define PORT_IRQ_IS_VALID_PRIORITY(n) \
+ (((n) >= 0U) && ((n) < CORTEX_PRIORITY_LEVELS))
/**
- * @brief Priority level to priority mask conversion macro.
+ * @brief Priority level verification macro.
*/
-#define CORTEX_PRIO_MASK(n) \
- ((n) << (8U - (unsigned)CORTEX_PRIORITY_BITS))
+#define PORT_IRQ_IS_VALID_KERNEL_PRIORITY(n) \
+ (((n) >= CORTEX_MAX_KERNEL_PRIORITY) && ((n) < CORTEX_PRIORITY_LEVELS))
/*===========================================================================*/
/* External declarations. */
diff --git a/os/rt/ports/ARMCMx/chcore_v7m.h b/os/rt/ports/ARMCMx/chcore_v7m.h index b437a8fad..37e087102 100644 --- a/os/rt/ports/ARMCMx/chcore_v7m.h +++ b/os/rt/ports/ARMCMx/chcore_v7m.h @@ -110,7 +110,7 @@ */
#if !defined(CORTEX_PRIORITY_SVCALL)
#define CORTEX_PRIORITY_SVCALL (CORTEX_MAXIMUM_PRIORITY + 1U)
-#elif !CORTEX_IS_VALID_PRIORITY(CORTEX_PRIORITY_SVCALL)
+#elif !PORT_IRQ_IS_VALID_PRIORITY(CORTEX_PRIORITY_SVCALL)
/* If it is externally redefined then better perform a validity check on it.*/
#error "invalid priority level specified for CORTEX_PRIORITY_SVCALL"
#endif
diff --git a/os/rt/templates/chcore.h b/os/rt/templates/chcore.h index 39d173608..bcc47a0f4 100644 --- a/os/rt/templates/chcore.h +++ b/os/rt/templates/chcore.h @@ -180,6 +180,16 @@ struct context { ((size_t)(n)) + ((size_t)(PORT_INT_REQUIRED_STACK)))
/**
+ * @brief Priority level verification macro.
+ */
+#define PORT_IRQ_IS_VALID_PRIORITY(n) false
+
+/**
+ * @brief Priority level verification macro.
+ */
+#define PORT_IRQ_IS_VALID_KERNEL_PRIORITY(n) false
+
+/**
* @brief IRQ prologue code.
* @details This macro must be inserted at the start of all IRQ handlers
* enabled to invoke system APIs.
|