aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-01-31 00:19:36 -0500
committerMarti Bolivar <mbolivar@leaflabs.com>2011-01-31 00:19:36 -0500
commit2e7fa60e435469d102522b0bc490ef4f21bbb989 (patch)
tree9ec3f1f03e3d98e9649fa90f5de1992aa51242dd /libmaple
parentf1b64e707d8aa7548954b110368a7eb46b827794 (diff)
downloadlibrambutan-2e7fa60e435469d102522b0bc490ef4f21bbb989.tar.gz
librambutan-2e7fa60e435469d102522b0bc490ef4f21bbb989.zip
nvic bugfix; removed unnecessary volatile usage
Diffstat (limited to 'libmaple')
-rw-r--r--libmaple/exti.c2
-rw-r--r--libmaple/nvic.c12
2 files changed, 7 insertions, 7 deletions
diff --git a/libmaple/exti.c b/libmaple/exti.c
index e806df9..150dd05 100644
--- a/libmaple/exti.c
+++ b/libmaple/exti.c
@@ -35,7 +35,7 @@ typedef struct ExtIChannel {
uint32 irq_line;
} ExtIChannel;
-volatile static ExtIChannel exti_channels[] = {
+static ExtIChannel exti_channels[] = {
{ .handler = NULL, .irq_line = NVIC_EXTI0 }, // EXTI0
{ .handler = NULL, .irq_line = NVIC_EXTI1 }, // EXTI1
{ .handler = NULL, .irq_line = NVIC_EXTI2 }, // EXTI2
diff --git a/libmaple/nvic.c b/libmaple/nvic.c
index 155da27..b1da605 100644
--- a/libmaple/nvic.c
+++ b/libmaple/nvic.c
@@ -39,8 +39,8 @@ void nvic_set_vector_table(uint32 addr, uint32 offset) {
* @param n interrupt number
*/
void nvic_irq_enable(uint32 n) {
- /* TODO: test */
- __write(BITBAND_PERI(NVIC_ISER0, n), 1);
+ uint32 *iser = &((uint32*)NVIC_ISER0)[(n/32)];
+ __write(iser, BIT(n % 32));
}
/**
@@ -48,8 +48,8 @@ void nvic_irq_enable(uint32 n) {
* @param n interrupt number
*/
void nvic_irq_disable(uint32 n) {
- /* TODO: test */
- __write(BITBAND_PERI(NVIC_ICER0, n), 1);
+ uint32 *icer = &((uint32*)NVIC_ICER0)[(n/32)];
+ __write(icer, BIT(n % 32));
}
void nvic_irq_disable_all(void) {
@@ -60,8 +60,8 @@ void nvic_irq_disable_all(void) {
64 interrupts, this suffices. */
/* TODO: fix for connectivity line: __write(NVIC_ICER2,1),
requires connectivity line support in libmaple.h */
- __write(NVIC_ICER0, 1);
- __write(NVIC_ICER1, 1);
+ __write(NVIC_ICER0, 0xFFFFFFFF);
+ __write(NVIC_ICER1, 0xFFFFFFFF);
}
/**