mbed library sources
Dependents: Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more
Superseded
This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.
Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.
If you are looking for a stable and tested release, please import one of the official mbed library releases:
Import librarymbed
The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
targets/cmsis/TARGET_NXP/TARGET_LPC82X/cmsis_nvic.c@337:6ed01c00b962, 2014-10-06 (annotated)
- Committer:
- mbed_official
- Date:
- Mon Oct 06 10:00:08 2014 +0100
- Revision:
- 337:6ed01c00b962
- Child:
- 358:9d7ef901f004
Synchronized with git revision b30176a071a49d95914b97d2ab98240f3a1e2cae
Full URL: https://github.com/mbedmicro/mbed/commit/b30176a071a49d95914b97d2ab98240f3a1e2cae/
Platform: LPC824 - new platform addition
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 337:6ed01c00b962 | 1 | /* mbed Microcontroller Library - cmsis_nvic for LPC11U24 |
mbed_official | 337:6ed01c00b962 | 2 | * Copyright (c) 2011 ARM Limited. All rights reserved. |
mbed_official | 337:6ed01c00b962 | 3 | * |
mbed_official | 337:6ed01c00b962 | 4 | * CMSIS-style functionality to support dynamic vectors |
mbed_official | 337:6ed01c00b962 | 5 | */ |
mbed_official | 337:6ed01c00b962 | 6 | #include "cmsis_nvic.h" |
mbed_official | 337:6ed01c00b962 | 7 | |
mbed_official | 337:6ed01c00b962 | 8 | #define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Vectors positioned at start of RAM |
mbed_official | 337:6ed01c00b962 | 9 | #define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash |
mbed_official | 337:6ed01c00b962 | 10 | |
mbed_official | 337:6ed01c00b962 | 11 | void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) { |
mbed_official | 337:6ed01c00b962 | 12 | uint32_t *vectors = (uint32_t*)SCB->VTOR; |
mbed_official | 337:6ed01c00b962 | 13 | uint32_t i; |
mbed_official | 337:6ed01c00b962 | 14 | |
mbed_official | 337:6ed01c00b962 | 15 | // Copy and switch to dynamic vectors if the first time called |
mbed_official | 337:6ed01c00b962 | 16 | if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) { |
mbed_official | 337:6ed01c00b962 | 17 | uint32_t *old_vectors = vectors; |
mbed_official | 337:6ed01c00b962 | 18 | vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS; |
mbed_official | 337:6ed01c00b962 | 19 | for (i=0; i<NVIC_NUM_VECTORS; i++) { |
mbed_official | 337:6ed01c00b962 | 20 | vectors[i] = old_vectors[i]; |
mbed_official | 337:6ed01c00b962 | 21 | } |
mbed_official | 337:6ed01c00b962 | 22 | SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS; |
mbed_official | 337:6ed01c00b962 | 23 | } |
mbed_official | 337:6ed01c00b962 | 24 | vectors[IRQn + 16] = vector; |
mbed_official | 337:6ed01c00b962 | 25 | } |
mbed_official | 337:6ed01c00b962 | 26 | |
mbed_official | 337:6ed01c00b962 | 27 | uint32_t NVIC_GetVector(IRQn_Type IRQn) { |
mbed_official | 337:6ed01c00b962 | 28 | uint32_t *vectors = (uint32_t*)SCB->VTOR; |
mbed_official | 337:6ed01c00b962 | 29 | return vectors[IRQn + 16]; |
mbed_official | 337:6ed01c00b962 | 30 | } |