From 7fb999bb529a00867293b67e04af2fa3b3b7225a Mon Sep 17 00:00:00 2001 From: iperry Date: Thu, 11 Mar 2010 05:17:57 +0000 Subject: turn usb interrupts on after failed assert so bootloader still works git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@148 749a229e-a60e-11de-b98f-4500b42dc123 --- src/lib/nvic.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/lib/nvic.c b/src/lib/nvic.c index 61e1d34..9b8c84f 100644 --- a/src/lib/nvic.c +++ b/src/lib/nvic.c @@ -36,6 +36,24 @@ void nvic_disable_interrupts(void) { REG_CLEAR_BIT(SYSTICK_CSR, 0); } + void nvic_set_vector_table(uint32_t *addr, uint32_t offset) { // SCB->VTOR = NVIC_VectTab | (Offset & (u32)0x1FFFFF80); } + + +/** + * @brief turn on interrupt number n + * @param[in] n interrupt number + */ +void nvic_enable_interrupt(uint32 n) { + if (n >= NVIC_NR_INTERRUPTS) { + return; + } + + if (n < 32) { + REG_SET_BIT(NVIC_ISER0, n); + } else { + REG_SET_BIT(NVIC_ISER1, n - 32); + } +} -- cgit v1.2.3