aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal')
-rw-r--r--os/hal/include/hal_pal.h36
-rw-r--r--os/hal/ports/STM32/LLD/GPIOv1/hal_pal_lld.h14
-rw-r--r--os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.h14
-rw-r--r--os/hal/ports/STM32/LLD/GPIOv3/hal_pal_lld.h14
4 files changed, 78 insertions, 0 deletions
diff --git a/os/hal/include/hal_pal.h b/os/hal/include/hal_pal.h
index df87d4d1a..9e0781554 100644
--- a/os/hal/include/hal_pal.h
+++ b/os/hal/include/hal_pal.h
@@ -912,6 +912,42 @@ typedef struct {
osalSysUnlock(); \
} while (false)
+/**
+ * @brief Pad event enable check.
+ *
+ * @param[in] port port identifier
+ * @param[in] pad pad number within the port
+ * @return Pad event status.
+ * @retval false if the pad event is disabled.
+ * @retval true if the pad event is enabled.
+ *
+ * @xclass
+ */
+#if !defined(pal_lld_ispadeventenabled) || defined(__DOXYGEN__)
+#define palIsPadEventEnabledX(port, pad) false
+#else
+#define palIsPadEventEnabledX(port, pad) \
+ pal_lld_ispadeventenabled(port, pad)
+#endif
+
+/**
+ * @brief Line event enable check.
+ *
+ * @param[in] line line identifier
+ * @return Line event status.
+ * @retval false if the line event is disabled.
+ * @retval true if the line event is enabled.
+ *
+ * @xclass
+ */
+#if !defined(pal_lld_islineeventenabled) || defined(__DOXYGEN__)
+#define palIsLineEventEnabledX(line) \
+ pal_lld_ispadeventenabled(PAL_PORT(line), PAL_PAD(line))
+#else
+#define palIsLineEventEnabledX(line) \
+ pal_lld_islineeventenabled(line)
+#endif
+
#endif /* PAL_USE_CALLBACKS || PAL_USE_WAIT */
#if (PAL_USE_CALLBACKS == TRUE) || defined(__DOXYGEN__)
diff --git a/os/hal/ports/STM32/LLD/GPIOv1/hal_pal_lld.h b/os/hal/ports/STM32/LLD/GPIOv1/hal_pal_lld.h
index 9ec04153c..d7d26942e 100644
--- a/os/hal/ports/STM32/LLD/GPIOv1/hal_pal_lld.h
+++ b/os/hal/ports/STM32/LLD/GPIOv1/hal_pal_lld.h
@@ -414,6 +414,20 @@ typedef uint32_t iopadid_t;
#define pal_lld_get_line_event(line) \
&_pal_events[PAL_PAD(line)]
+/**
+ * @brief Pad event enable check.
+ *
+ * @param[in] port port identifier
+ * @param[in] pad pad number within the port
+ * @return Pad event status.
+ * @retval false if the pad event is disabled.
+ * @retval true if the pad event is enabled.
+ *
+ * @notapi
+ */
+#define pal_lld_ispadeventenabled(port, pad) \
+ (bool)((EXTI->IMR & (1U << (uint32_t)pad)) != 0U)
+
#if !defined(__DOXYGEN__)
extern const PALConfig pal_default_config;
extern palevent_t _pal_events[16];
diff --git a/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.h b/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.h
index 1d9033753..d6dd4df72 100644
--- a/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.h
+++ b/os/hal/ports/STM32/LLD/GPIOv2/hal_pal_lld.h
@@ -472,6 +472,20 @@ typedef uint32_t iopadid_t;
#define pal_lld_get_line_event(line) \
&_pal_events[PAL_PAD(line)]
+/**
+ * @brief Pad event enable check.
+ *
+ * @param[in] port port identifier
+ * @param[in] pad pad number within the port
+ * @return Pad event status.
+ * @retval false if the pad event is disabled.
+ * @retval true if the pad event is enabled.
+ *
+ * @notapi
+ */
+#define pal_lld_ispadeventenabled(port, pad) \
+ (bool)((EXTI->IMR & (1U << (uint32_t)pad)) != 0U)
+
#if !defined(__DOXYGEN__)
extern palevent_t _pal_events[16];
#endif
diff --git a/os/hal/ports/STM32/LLD/GPIOv3/hal_pal_lld.h b/os/hal/ports/STM32/LLD/GPIOv3/hal_pal_lld.h
index 638c9a81d..0348744a0 100644
--- a/os/hal/ports/STM32/LLD/GPIOv3/hal_pal_lld.h
+++ b/os/hal/ports/STM32/LLD/GPIOv3/hal_pal_lld.h
@@ -512,6 +512,20 @@ typedef uint32_t iopadid_t;
#define pal_lld_get_line_event(line) \
&_pal_events[PAL_PAD(line)]
+/**
+ * @brief Pad event enable check.
+ *
+ * @param[in] port port identifier
+ * @param[in] pad pad number within the port
+ * @return Pad event status.
+ * @retval false if the pad event is disabled.
+ * @retval true if the pad event is enabled.
+ *
+ * @notapi
+ */
+#define pal_lld_ispadeventenabled(port, pad) \
+ (bool)((EXTI->IMR & (1U << (uint32_t)pad)) != 0U)
+
#if !defined(__DOXYGEN__)
extern palevent_t _pal_events[16];
#endif