mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
targets/cmsis/TARGET_NXP/TARGET_LPC11U6X/cmsis_nvic.c@174:8bb9f3a33240, 2014-04-29 (annotated)
- Committer:
- mbed_official
- Date:
- Tue Apr 29 11:15:07 2014 +0100
- Revision:
- 174:8bb9f3a33240
Synchronized with git revision 5bf985ebc651a2c31cefabd9d62c51dc465ef60a
Full URL: https://github.com/mbedmicro/mbed/commit/5bf985ebc651a2c31cefabd9d62c51dc465ef60a/
[NUCLEO_L152RE/F103RB] Add LSE configuration for RTC
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 174:8bb9f3a33240 | 1 | /* mbed Microcontroller Library - cmsis_nvic for LPC11U24 |
mbed_official | 174:8bb9f3a33240 | 2 | * Copyright (c) 2011 ARM Limited. All rights reserved. |
mbed_official | 174:8bb9f3a33240 | 3 | * |
mbed_official | 174:8bb9f3a33240 | 4 | * CMSIS-style functionality to support dynamic vectors |
mbed_official | 174:8bb9f3a33240 | 5 | */ |
mbed_official | 174:8bb9f3a33240 | 6 | #include "cmsis_nvic.h" |
mbed_official | 174:8bb9f3a33240 | 7 | |
mbed_official | 174:8bb9f3a33240 | 8 | #define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Vectors positioned at start of RAM |
mbed_official | 174:8bb9f3a33240 | 9 | #define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash |
mbed_official | 174:8bb9f3a33240 | 10 | |
mbed_official | 174:8bb9f3a33240 | 11 | void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) { |
mbed_official | 174:8bb9f3a33240 | 12 | uint32_t *vectors = (uint32_t*)SCB->VTOR; |
mbed_official | 174:8bb9f3a33240 | 13 | uint32_t i; |
mbed_official | 174:8bb9f3a33240 | 14 | |
mbed_official | 174:8bb9f3a33240 | 15 | // Copy and switch to dynamic vectors if the first time called |
mbed_official | 174:8bb9f3a33240 | 16 | if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) { |
mbed_official | 174:8bb9f3a33240 | 17 | uint32_t *old_vectors = vectors; |
mbed_official | 174:8bb9f3a33240 | 18 | vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS; |
mbed_official | 174:8bb9f3a33240 | 19 | for (i=0; i<NVIC_NUM_VECTORS; i++) { |
mbed_official | 174:8bb9f3a33240 | 20 | vectors[i] = old_vectors[i]; |
mbed_official | 174:8bb9f3a33240 | 21 | } |
mbed_official | 174:8bb9f3a33240 | 22 | SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS; |
mbed_official | 174:8bb9f3a33240 | 23 | } |
mbed_official | 174:8bb9f3a33240 | 24 | vectors[IRQn + 16] = vector; |
mbed_official | 174:8bb9f3a33240 | 25 | } |
mbed_official | 174:8bb9f3a33240 | 26 | |
mbed_official | 174:8bb9f3a33240 | 27 | uint32_t NVIC_GetVector(IRQn_Type IRQn) { |
mbed_official | 174:8bb9f3a33240 | 28 | uint32_t *vectors = (uint32_t*)SCB->VTOR; |
mbed_official | 174:8bb9f3a33240 | 29 | return vectors[IRQn + 16]; |
mbed_official | 174:8bb9f3a33240 | 30 | } |