Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-src by
targets/cmsis/TARGET_NXP/TARGET_LPC15XX/cmsis_nvic.c@103:9b881da47c92, 2014-02-20 (annotated)
- Committer:
- mbed_official
- Date:
- Thu Feb 20 23:00:08 2014 +0000
- Revision:
- 103:9b881da47c92
- Child:
- 358:9d7ef901f004
Synchronized with git revision 1f2da5f6047218c8c45334c11bdaaaeab3c18841
Full URL: https://github.com/mbedmicro/mbed/commit/1f2da5f6047218c8c45334c11bdaaaeab3c18841/
NXP master merge
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 103:9b881da47c92 | 1 | /* mbed Microcontroller Library - cmsis_nvic for LPC11U24 |
mbed_official | 103:9b881da47c92 | 2 | * Copyright (c) 2011 ARM Limited. All rights reserved. |
mbed_official | 103:9b881da47c92 | 3 | * |
mbed_official | 103:9b881da47c92 | 4 | * CMSIS-style functionality to support dynamic vectors |
mbed_official | 103:9b881da47c92 | 5 | */ |
mbed_official | 103:9b881da47c92 | 6 | #include "cmsis_nvic.h" |
mbed_official | 103:9b881da47c92 | 7 | |
mbed_official | 103:9b881da47c92 | 8 | #define NVIC_RAM_VECTOR_ADDRESS (0x02000000) // Vectors positioned at start of RAM |
mbed_official | 103:9b881da47c92 | 9 | #define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash |
mbed_official | 103:9b881da47c92 | 10 | |
mbed_official | 103:9b881da47c92 | 11 | void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) { |
mbed_official | 103:9b881da47c92 | 12 | uint32_t *vectors = (uint32_t*)SCB->VTOR; |
mbed_official | 103:9b881da47c92 | 13 | uint32_t i; |
mbed_official | 103:9b881da47c92 | 14 | |
mbed_official | 103:9b881da47c92 | 15 | // Copy and switch to dynamic vectors if the first time called |
mbed_official | 103:9b881da47c92 | 16 | if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) { |
mbed_official | 103:9b881da47c92 | 17 | uint32_t *old_vectors = vectors; |
mbed_official | 103:9b881da47c92 | 18 | vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS; |
mbed_official | 103:9b881da47c92 | 19 | for (i=0; i<NVIC_NUM_VECTORS; i++) { |
mbed_official | 103:9b881da47c92 | 20 | vectors[i] = old_vectors[i]; |
mbed_official | 103:9b881da47c92 | 21 | } |
mbed_official | 103:9b881da47c92 | 22 | SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS; |
mbed_official | 103:9b881da47c92 | 23 | } |
mbed_official | 103:9b881da47c92 | 24 | vectors[IRQn + 16] = vector; |
mbed_official | 103:9b881da47c92 | 25 | } |
mbed_official | 103:9b881da47c92 | 26 | |
mbed_official | 103:9b881da47c92 | 27 | uint32_t NVIC_GetVector(IRQn_Type IRQn) { |
mbed_official | 103:9b881da47c92 | 28 | uint32_t *vectors = (uint32_t*)SCB->VTOR; |
mbed_official | 103:9b881da47c92 | 29 | return vectors[IRQn + 16]; |
mbed_official | 103:9b881da47c92 | 30 | } |