aboutsummaryrefslogtreecommitdiffstats
path: root/libmaple/nvic.h
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@leaflabs.com>2011-09-14 14:42:04 -0400
committerMarti Bolivar <mbolivar@leaflabs.com>2011-09-14 14:42:04 -0400
commita9f14657020161fe8798e23489ce7b9489bbe815 (patch)
tree3b561e75b79b18c8bc851ba1b06ca1058050ebda /libmaple/nvic.h
parent5ba24f6befb6016410df398a049054cf34365895 (diff)
parent3f03c0c1edc74b3fb95f178a45a111a2d3381719 (diff)
downloadlibrambutan-a9f14657020161fe8798e23489ce7b9489bbe815.tar.gz
librambutan-a9f14657020161fe8798e23489ce7b9489bbe815.zip
Merge remote branch 'nzmichaelh/comment-fixups-2'
Diffstat (limited to 'libmaple/nvic.h')
-rw-r--r--libmaple/nvic.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/libmaple/nvic.h b/libmaple/nvic.h
index 1630bc1..e3b052d 100644
--- a/libmaple/nvic.h
+++ b/libmaple/nvic.h
@@ -27,6 +27,20 @@
/**
* @file nvic.h
* @brief Nested vector interrupt controller support.
+ *
+ * Basic usage:
+ *
+ * @code
+ * // Initialise the interrupt controller and point to the vector
+ * // table at the start of flash.
+ * nvic_init(0x08000000, 0);
+ * // Bind in a timer interrupt handler
+ * timer_attach_interrupt(TIMER_CC1_INTERRUPT, handler);
+ * // Optionally set the priority
+ * nvic_irq_set_priority(NVIC_TIMER1_CC, 5);
+ * // All done, enable all interrupts
+ * nvic_globalirq_enable();
+ * @endcode
*/
#ifndef _NVIC_H_
@@ -146,8 +160,22 @@ typedef enum nvic_irq_num {
#endif
} nvic_irq_num;
+/*
+ * Initialises the interrupt controller and sets all interrupts to the
+ * lowest priority.
+ *
+ * For stand-alone products, the base address is normally the start of
+ * flash (0x08000000).
+ *
+ * @param vector_table_address base address of the vector table
+ */
void nvic_init(uint32 vector_table_address, uint32 offset);
+
+/**
+ * Sets the base address of the vector table.
+ */
void nvic_set_vector_table(uint32 address, uint32 offset);
+
void nvic_irq_set_priority(nvic_irq_num irqn, uint8 priority);
/**