aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-08-03 12:39:03 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-08-03 17:34:03 -0400
commit711dc06ec6d58a772950fb2852c1461a792c0342 (patch)
tree5095bce19468c8c9e307c78cc5a903417a5a5320 /libmaple
parent1b85253f861967e97690d161633834e835a55ef1 (diff)
downloadlibrambutan-711dc06ec6d58a772950fb2852c1461a792c0342.tar.gz
librambutan-711dc06ec6d58a772950fb2852c1461a792c0342.zip
exti.c: Remove enable_irq() and maybe_disable_irq().
These functions incorrectly replicate functionality that is already accomplished by manipulating EXTI_IMR directly.
Diffstat (limited to 'libmaple')
-rw-r--r--libmaple/exti.c37
1 files changed, 1 insertions, 36 deletions
diff --git a/libmaple/exti.c b/libmaple/exti.c
index a3a2db7..0678d4c 100644
--- a/libmaple/exti.c
+++ b/libmaple/exti.c
@@ -38,10 +38,6 @@
* Internal state
*/
-/* Status bitmaps, for external interrupts with multiplexed IRQs */
-static uint16 exti_9_5_en = 0;
-static uint16 exti_15_10_en = 0;
-
typedef struct exti_channel {
void (*handler)(void);
uint32 irq_line;
@@ -70,9 +66,6 @@ static exti_channel exti_channels[] = {
* Convenience routines
*/
-static inline void enable_irq(afio_exti_num exti_num);
-static inline void maybe_disable_irq(afio_exti_num exti_num);
-
/**
* @brief Register a handler to run upon external interrupt.
*
@@ -118,7 +111,7 @@ void exti_attach_interrupt(afio_exti_num num,
bb_peri_set_bit(&EXTI_BASE->IMR, num, 1);
/* Enable the interrupt line */
- enable_irq(num);
+ nvic_irq_enable(exti_channels[num].irq_line);
}
/**
@@ -134,10 +127,6 @@ void exti_detach_interrupt(afio_exti_num num) {
bb_peri_set_bit(&EXTI_BASE->FTSR, num, 0);
bb_peri_set_bit(&EXTI_BASE->RTSR, num, 0);
- /* Next, disable the IRQ, unless it's multiplexed and there are
- * other active external interrupts on the same IRQ line */
- maybe_disable_irq(num);
-
/* Finally, unregister the user's handler */
exti_channels[num].handler = NULL;
}
@@ -223,27 +212,3 @@ static inline void dispatch_handler(uint32 exti_num) {
static inline void clear_pending(uint32 exti_num) {
EXTI_BASE->PR = 1 << exti_num;
}
-
-static inline void enable_irq(afio_exti_num exti) {
- /* Maybe twiddle the IRQ bitmap for extis with multiplexed IRQs */
- if (exti > 4) {
- uint16 *bitmap = exti < 10 ? &exti_9_5_en : &exti_15_10_en;
- *bb_sramp(bitmap, exti) = 1;
- }
-
- nvic_irq_enable(exti_channels[exti].irq_line);
-}
-
-static inline void maybe_disable_irq(afio_exti_num exti) {
- if (exti > 4) {
- uint16 *bitmap = exti < 10 ? &exti_9_5_en : &exti_15_10_en;
- *bb_sramp(bitmap, exti) = 0;
- if (*bitmap == 0) {
- /* All of the external interrupts which share this IRQ
- * line are disabled. */
- nvic_irq_disable(exti_channels[exti].irq_line);
- }
- } else {
- nvic_irq_disable(exti_channels[exti].irq_line);
- }
-}