aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/eicu_lld.c
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/ports/STM32/LLD/eicu_lld.c')
-rw-r--r--os/hal/ports/STM32/LLD/eicu_lld.c205
1 files changed, 205 insertions, 0 deletions
diff --git a/os/hal/ports/STM32/LLD/eicu_lld.c b/os/hal/ports/STM32/LLD/eicu_lld.c
index 8523078..38da716 100644
--- a/os/hal/ports/STM32/LLD/eicu_lld.c
+++ b/os/hal/ports/STM32/LLD/eicu_lld.c
@@ -56,6 +56,7 @@
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
+
/**
* @brief EICUD1 driver identifier.
* @note The driver EICUD1 allocates the complex timer TIM1 when enabled.
@@ -120,6 +121,38 @@ EICUDriver EICUD9;
EICUDriver EICUD12;
#endif
+/**
+ * @brief EICUD10 driver identifier.
+ * @note The driver EICUD10 allocates the timer TIM10 when enabled.
+ */
+#if STM32_EICU_USE_TIM10 && !defined(__DOXYGEN__)
+EICUDriver EICUD10;
+#endif
+
+/**
+ * @brief EICUD11 driver identifier.
+ * @note The driver EICUD11 allocates the timer TIM11 when enabled.
+ */
+#if STM32_EICU_USE_TIM11 && !defined(__DOXYGEN__)
+EICUDriver EICUD11;
+#endif
+
+/**
+ * @brief EICUD13 driver identifier.
+ * @note The driver EICUD13 allocates the timer TIM13 when enabled.
+ */
+#if STM32_EICU_USE_TIM13 && !defined(__DOXYGEN__)
+EICUDriver EICUD13;
+#endif
+
+/**
+ * @brief EICUD14 driver identifier.
+ * @note The driver EICUD14 allocates the timer TIM14 when enabled.
+ */
+#if STM32_EICU_USE_TIM14 && !defined(__DOXYGEN__)
+EICUDriver EICUD14;
+#endif
+
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
@@ -635,6 +668,94 @@ OSAL_IRQ_HANDLER(STM32_TIM12_HANDLER) {
}
#endif /* STM32_EICU_USE_TIM12 */
+#if STM32_EICU_USE_TIM10
+#if !defined(STM32_TIM10_HANDLER)
+#error "STM32_TIM10_HANDLER not defined"
+#endif
+/**
+ * @brief TIM10 interrupt handler.
+ * @note It is assumed that the various sources are only activated if the
+ * associated callback pointer is not equal to @p NULL in order to not
+ * perform an extra check in a potentially critical interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(STM32_TIM10_HANDLER) {
+
+ OSAL_IRQ_PROLOGUE();
+
+ eicu_lld_serve_interrupt(&EICUD10);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif /* STM32_EICU_USE_TIM10 */
+
+#if STM32_EICU_USE_TIM11
+#if !defined(STM32_TIM11_HANDLER)
+#error "STM32_TIM11_HANDLER not defined"
+#endif
+/**
+ * @brief TIM11 interrupt handler.
+ * @note It is assumed that the various sources are only activated if the
+ * associated callback pointer is not equal to @p NULL in order to not
+ * perform an extra check in a potentially critical interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(STM32_TIM11_HANDLER) {
+
+ OSAL_IRQ_PROLOGUE();
+
+ eicu_lld_serve_interrupt(&EICUD11);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif /* STM32_EICU_USE_TIM11 */
+
+#if STM32_EICU_USE_TIM13
+#if !defined(STM32_TIM13_HANDLER)
+#error "STM32_TIM13_HANDLER not defined"
+#endif
+/**
+ * @brief TIM13 interrupt handler.
+ * @note It is assumed that the various sources are only activated if the
+ * associated callback pointer is not equal to @p NULL in order to not
+ * perform an extra check in a potentially critical interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(STM32_TIM13_HANDLER) {
+
+ OSAL_IRQ_PROLOGUE();
+
+ eicu_lld_serve_interrupt(&EICUD13);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif /* STM32_EICU_USE_TIM13 */
+
+#if STM32_EICU_USE_TIM14
+#if !defined(STM32_TIM14_HANDLER)
+#error "STM32_TIM14_HANDLER not defined"
+#endif
+/**
+ * @brief TIM14 interrupt handler.
+ * @note It is assumed that the various sources are only activated if the
+ * associated callback pointer is not equal to @p NULL in order to not
+ * perform an extra check in a potentially critical interrupt handler.
+ *
+ * @isr
+ */
+OSAL_IRQ_HANDLER(STM32_TIM14_HANDLER) {
+
+ OSAL_IRQ_PROLOGUE();
+
+ eicu_lld_serve_interrupt(&EICUD14);
+
+ OSAL_IRQ_EPILOGUE();
+}
+#endif /* STM32_EICU_USE_TIM14 */
+
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
@@ -692,6 +813,30 @@ void eicu_lld_init(void) {
eicuObjectInit(&EICUD12);
EICUD12.tim = STM32_TIM12;
#endif
+
+#if STM32_EICU_USE_TIM10
+ /* Driver initialization.*/
+ eicuObjectInit(&EICUD10);
+ EICUD10.tim = STM32_TIM10;
+#endif
+
+#if STM32_EICU_USE_TIM11
+ /* Driver initialization.*/
+ eicuObjectInit(&EICUD11);
+ EICUD11.tim = STM32_TIM11;
+#endif
+
+#if STM32_EICU_USE_TIM13
+ /* Driver initialization.*/
+ eicuObjectInit(&EICUD13);
+ EICUD13.tim = STM32_TIM13;
+#endif
+
+#if STM32_EICU_USE_TIM14
+ /* Driver initialization.*/
+ eicuObjectInit(&EICUD14);
+ EICUD14.tim = STM32_TIM14;
+#endif
}
/**
@@ -795,6 +940,42 @@ void eicu_lld_start(EICUDriver *eicup) {
eicup->clock = STM32_TIMCLK1;
}
#endif
+#if STM32_EICU_USE_TIM10
+ if (&EICUD10 == eicup) {
+ rccEnableTIM10(FALSE);
+ rccResetTIM10();
+ nvicEnableVector(STM32_TIM10_NUMBER, STM32_EICU_TIM10_IRQ_PRIORITY);
+ eicup->channels = 1;
+ eicup->clock = STM32_TIMCLK1;
+ }
+#endif
+#if STM32_EICU_USE_TIM11
+ if (&EICUD11 == eicup) {
+ rccEnableTIM11(FALSE);
+ rccResetTIM11();
+ nvicEnableVector(STM32_TIM11_NUMBER, STM32_EICU_TIM11_IRQ_PRIORITY);
+ eicup->channels = 1;
+ eicup->clock = STM32_TIMCLK1;
+ }
+#endif
+#if STM32_EICU_USE_TIM13
+ if (&EICUD13 == eicup) {
+ rccEnableTIM13(FALSE);
+ rccResetTIM13();
+ nvicEnableVector(STM32_TIM13_NUMBER, STM32_EICU_TIM13_IRQ_PRIORITY);
+ eicup->channels = 1;
+ eicup->clock = STM32_TIMCLK1;
+ }
+#endif
+#if STM32_EICU_USE_TIM14
+ if (&EICUD14 == eicup) {
+ rccEnableTIM14(FALSE);
+ rccResetTIM14();
+ nvicEnableVector(STM32_TIM14_NUMBER, STM32_EICU_TIM14_IRQ_PRIORITY);
+ eicup->channels = 1;
+ eicup->clock = STM32_TIMCLK1;
+ }
+#endif
}
else {
/* Driver re-configuration scenario, it must be stopped first.*/
@@ -920,6 +1101,30 @@ void eicu_lld_stop(EICUDriver *eicup) {
}
#endif
}
+#if STM32_EICU_USE_TIM10
+ if (&EICUD10 == eicup) {
+ nvicDisableVector(STM32_TIM10_NUMBER);
+ rccDisableTIM10(FALSE);
+ }
+#endif
+#if STM32_EICU_USE_TIM11
+ if (&EICUD11 == eicup) {
+ nvicDisableVector(STM32_TIM11_NUMBER);
+ rccDisableTIM11(FALSE);
+ }
+#endif
+#if STM32_EICU_USE_TIM13
+ if (&EICUD13 == eicup) {
+ nvicDisableVector(STM32_TIM13_NUMBER);
+ rccDisableTIM13(FALSE);
+ }
+#endif
+#if STM32_EICU_USE_TIM14
+ if (&EICUD14 == eicup) {
+ nvicDisableVector(STM32_TIM14_NUMBER);
+ rccDisableTIM14(FALSE);
+ }
+#endif
}
/**