aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoriperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123>2010-03-11 05:17:57 +0000
committeriperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123>2010-03-11 05:17:57 +0000
commit7fb999bb529a00867293b67e04af2fa3b3b7225a (patch)
treedd2a45b4474baca0a94f55c42c99f9c730db3bc9
parent64444756ecd2d9127529ae19a17cfbfa58f1cc69 (diff)
downloadlibrambutan-7fb999bb529a00867293b67e04af2fa3b3b7225a.tar.gz
librambutan-7fb999bb529a00867293b67e04af2fa3b3b7225a.zip
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
-rw-r--r--src/lib/nvic.c18
1 files changed, 18 insertions, 0 deletions
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);
+ }
+}