diff options
author | Perry Hung <iperry@alum.mit.edu> | 2010-08-04 08:52:30 -0400 |
---|---|---|
committer | Perry Hung <iperry@alum.mit.edu> | 2010-08-04 08:52:30 -0400 |
commit | d2494611156c4ba477a1bbd1b07ba0cfc14b29e4 (patch) | |
tree | 48782014152efa392ac0689c4098e089da52c82c /libmaple/nvic.c | |
parent | 2b7a1b40c96525cd4c6324f6e9d53845fb07a55f (diff) | |
download | librambutan-d2494611156c4ba477a1bbd1b07ba0cfc14b29e4.tar.gz librambutan-d2494611156c4ba477a1bbd1b07ba0cfc14b29e4.zip |
Cleaned up wirish/time, some interrupt handling refactoring:
Fixed millis(), it was just wrong, before.
Added micros(), not extensively tested.
New implementation of delayMicroseconds(). Should be more consistent
now.
Added a handful of nvic routines to enable/disable interrupts.
Cleaned up systick
Diffstat (limited to 'libmaple/nvic.c')
-rw-r--r-- | libmaple/nvic.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/libmaple/nvic.c b/libmaple/nvic.c index d8745a4..56b9940 100644 --- a/libmaple/nvic.c +++ b/libmaple/nvic.c @@ -32,16 +32,6 @@ #include "nvic.h" #include "systick.h" -void nvic_disable_interrupts(void) { - /* Turn off all interrupts */ - REG_SET(NVIC_ICER0, 0xFFFFFFFF); - REG_SET(NVIC_ICER1, 0xFFFFFFFF); - - /* Turn off systick exception */ - REG_CLEAR_BIT(SYSTICK_CSR, 0); -} - - void nvic_set_vector_table(uint32 addr, uint32 offset) { __write(SCB_VTOR, (uint32)addr | (offset & 0x1FFFFF80)); } @@ -49,13 +39,9 @@ void nvic_set_vector_table(uint32 addr, uint32 offset) { /** * @brief turn on interrupt number n - * @param[in] n interrupt number + * @param n interrupt number */ -void nvic_enable_interrupt(uint32 n) { - if (n >= NVIC_NR_INTERRUPTS) { - return; - } - +void nvic_irq_enable(uint32 n) { if (n < 32) { REG_SET_BIT(NVIC_ISER0, n); } else { @@ -65,13 +51,9 @@ void nvic_enable_interrupt(uint32 n) { /** * @brief turn off interrupt number n - * @param[in] n interrupt number + * @param n interrupt number */ -void nvic_disable_interrupt(uint32 n) { - if (n >= NVIC_NR_INTERRUPTS) { - return; - } - +void nvic_irq_disable(uint32 n) { if (n < 32) { REG_SET_BIT(NVIC_ICER0, n); } else { |