diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-11-18 16:00:59 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-11-18 16:00:59 +0000 |
commit | e9fbae0881b5c4aa4302ff2629efe06360e34fa5 (patch) | |
tree | 6e2b438fe9a269d164b2891af55ab5ace65c30ea /os/hal | |
parent | 118309d74b27da5d7c69fbc81f6bbc4b32d9dc36 (diff) | |
download | ChibiOS-e9fbae0881b5c4aa4302ff2629efe06360e34fa5.tar.gz ChibiOS-e9fbae0881b5c4aa4302ff2629efe06360e34fa5.tar.bz2 ChibiOS-e9fbae0881b5c4aa4302ff2629efe06360e34fa5.zip |
Efficiency changes.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12436 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal')
-rw-r--r-- | os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.c | 41 | ||||
-rw-r--r-- | os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h | 37 |
2 files changed, 35 insertions, 43 deletions
diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.c b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.c index cdf50408f..d2d448e80 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.c +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.c @@ -33,15 +33,6 @@ /* Driver local definitions. */
/*===========================================================================*/
-/* Handling differences in ST headers.*/
-#if !defined(STM32L4XX) && !defined(STM32L4XXP)
-#define EMR1 EMR
-#define IMR1 IMR
-#define PR1 PR
-#define RTSR1 RTSR
-#define FTSR1 FTSR
-#endif
-
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
@@ -187,38 +178,6 @@ void extiEnableLine(extiline_t line, extimode_t mode) { }
/**
- * @brief STM32 EXTI group 1 IRQ status clearing.
- *
- * @param[in] mask mask of group 1 lines to be initialized
- *
- * @api
- */
-void extiClearGroup1(uint32_t mask) {
-
- /* Masked out lines must not be touched by this driver.*/
- osalDbgAssert((mask & STM32_EXTI_IMR1_MASK) == 0U, "fixed line");
-
- EXTI->PR1 = mask;
-}
-
-#if (STM32_EXTI_NUM_LINES > 32) || defined(__DOXYGEN__)
-/**
- * @brief STM32 EXTI group 2 IRQ status clearing.
- *
- * @param[in] mask mask of group 2 lines to be initialized
- *
- * @api
- */
-void extiClearGroup2(uint32_t mask) {
-
- /* Masked out lines must not be touched by this driver.*/
- osalDbgAssert((mask & STM32_EXTI_IMR2_MASK) == 0U, "fixed line");
-
- EXTI->PR2 = mask;
-}
-#endif /* STM32_EXTI_NUM_LINES > 32 */
-
-/**
* @brief STM32 EXTI line IRQ status clearing.
*
* @param[in] line line to be initialized
diff --git a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h index cb4b2826d..046eec162 100644 --- a/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h +++ b/os/hal/ports/STM32/LLD/EXTIv1/stm32_exti.h @@ -44,6 +44,15 @@ #define EXTI_MODE_ACTION_EVENT 4U /**< @brief Event mode. */
/** @} */
+/* Handling differences in ST headers.*/
+#if !defined(STM32L4XX) && !defined(STM32L4XXP)
+#define EMR1 EMR
+#define IMR1 IMR
+#define PR1 PR
+#define RTSR1 RTSR
+#define FTSR1 FTSR
+#endif
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -102,6 +111,32 @@ typedef uint32_t extimode_t; */
#define EXTI_MASK2(line) (uint32_t)(1U << ((line) - 32U))
+/**
+ * @brief STM32 EXTI group 1 IRQ status clearing.
+ *
+ * @param[in] mask mask of group 1 lines to be initialized
+ *
+ * @api
+ */
+#define extiClearGroup1(mask) do { \
+ osalDbgAssert(((mask) & STM32_EXTI_IMR1_MASK) == 0U, "fixed lines"); \
+ EXTI->PR1 = (uint32_t)(mask); \
+} while (false)
+
+#if (STM32_EXTI_NUM_LINES > 32) || defined(__DOXYGEN__)
+/**
+ * @brief STM32 EXTI group 2 IRQ status clearing.
+ *
+ * @param[in] mask mask of group 2 lines to be initialized
+ *
+ * @api
+ */
+#define extiClearGroup2(mask) do { \
+ osalDbgAssert(((mask) & STM32_EXTI_IMR2_MASK) == 0U, "fixed lines"); \
+ EXTI->PR2 = (uint32_t)(mask); \
+} while (false)
+#endif /* STM32_EXTI_NUM_LINES > 32 */
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
@@ -110,10 +145,8 @@ typedef uint32_t extimode_t; extern "C" {
#endif
void extiEnableGroup1(uint32_t mask, extimode_t mode);
- void extiClearGroup1(uint32_t mask);
#if (STM32_EXTI_NUM_LINES > 32) || defined(__DOXYGEN__)
void extiEnableGroup2(uint32_t mask, extimode_t mode);
- void extiClearGroup2(uint32_t mask);
#endif /* STM32_EXTI_NUM_LINES > 32 */
void extiEnableLine(extiline_t line, extimode_t mode);
void extiClearLine(extiline_t line);
|