aboutsummaryrefslogtreecommitdiff
path: root/libmaple/nvic.c
diff options
context:
space:
mode:
authorMarti Bolivar <mbolivar@mit.edu>2010-12-29 21:30:42 -0500
committerMarti Bolivar <mbolivar@mit.edu>2010-12-30 02:40:16 -0500
commit8e973f3d1ef0324e213824dc05af0f9713e7b3cb (patch)
treeb5ff3aebf87116b5de0e968a1f44309478a6c430 /libmaple/nvic.c
parentd1a8d832af96efdd1b399799dfae81517dc04dfa (diff)
Changed nzmichaelh's initial DMA interface to be more flexible.
Some bugfixes in the external interrupt code were found along the way. Defines for nonexistent registers removed from nvic interface.
Diffstat (limited to 'libmaple/nvic.c')
-rw-r--r--libmaple/nvic.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libmaple/nvic.c b/libmaple/nvic.c
index 5b32d16..ad816ba 100644
--- a/libmaple/nvic.c
+++ b/libmaple/nvic.c
@@ -23,8 +23,6 @@
*****************************************************************************/
/**
- * @file nvic.c
- *
* @brief Nested interrupt controller routines
*/
@@ -41,6 +39,7 @@ void nvic_set_vector_table(uint32 addr, uint32 offset) {
* @param n interrupt number
*/
void nvic_irq_enable(uint32 n) {
+ /* TODO: bit-banding would be faster */
uint32 *iser = &((uint32*)NVIC_ISER0)[(n/32)];
__write(iser, BIT(n % 32));
}
@@ -50,11 +49,16 @@ void nvic_irq_enable(uint32 n) {
* @param n interrupt number
*/
void nvic_irq_disable(uint32 n) {
+ /* TODO: bit-banding would be faster */
uint32 *icer = &((uint32*)NVIC_ICER0)[(n/32)];
__write(icer, BIT(n % 32));
}
void nvic_irq_disable_all(void) {
+ /* TODO why not:
+ __write(NVIC_ICER0, 0);
+ __write(NVIC_ICER1, 0);
+ */
short n;
for(n=0; n<65; n++) {
nvic_irq_disable(n);
@@ -62,8 +66,8 @@ void nvic_irq_disable_all(void) {
}
/**
- * @brief Initialice the NVIC at address addr
- * @param addr Address to set the vector table at
+ * @brief Initialize the NVIC according to VECT_TAB_FLASH,
+ * VECT_TAB_RAM, or VECT_TAB_BASE.
*/
void nvic_init(void) {
#ifdef VECT_TAB_FLASH