From 62552a6f3f93223682f9df2df2614411f7e3d54c Mon Sep 17 00:00:00 2001 From: Perry Hung Date: Sun, 25 Apr 2010 18:08:56 -0400 Subject: Refactoring: The 'core' directory has now been renamed to 'wirish.' Wirish is our version of the Arduino Wiring language. --- libmaple/nvic.c | 15 +++++++++++++++ libmaple/nvic.h | 6 +++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'libmaple') diff --git a/libmaple/nvic.c b/libmaple/nvic.c index 91e572e..6603d42 100644 --- a/libmaple/nvic.c +++ b/libmaple/nvic.c @@ -64,3 +64,18 @@ void nvic_enable_interrupt(uint32 n) { } + +/** + * @brief Initialice the NVIC at address addr + * @param addr Address to set the vector table at + */ +void nvic_init(void) { +#ifdef VECT_TAB_ROM + nvic_set_vector_table(USER_ADDR_ROM, 0x0); +#elif defined VECT_TAB_RAM + nvic_set_vector_table(USER_ADDR_RAM, 0x0); +#else // VECT_TAB_BASE + /* Set the Vector Table base location at 0x08000000 */ + nvic_set_vector_table(((uint32)0x08000000), 0x0); +#endif +} diff --git a/libmaple/nvic.h b/libmaple/nvic.h index e785018..a9f32d6 100644 --- a/libmaple/nvic.h +++ b/libmaple/nvic.h @@ -54,10 +54,15 @@ #define NVIC_NR_INTERRUPTS 60 +/* Where to put code */ +#define USER_ADDR_ROM 0x08005000 +#define USER_ADDR_RAM 0x20000C00 + #ifdef __cplusplus extern "C"{ #endif +void nvic_init(void); void nvic_disable_interrupts(void); void nvic_enable_interrupt(uint32); @@ -65,6 +70,5 @@ void nvic_enable_interrupt(uint32); } #endif - #endif -- cgit v1.2.3