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.

Committer:
bogdanm
Date:
Mon Aug 05 14:12:34 2013 +0300
Revision:
13:0645d8841f51
Child:
15:4892fe388435
Update mbed sources to revision 64

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 13:0645d8841f51 1 /* mbed Microcontroller Library - cmsis_nvic for LCP1768
bogdanm 13:0645d8841f51 2 * Copyright (c) 2009-2011 ARM Limited. All rights reserved.
bogdanm 13:0645d8841f51 3 *
bogdanm 13:0645d8841f51 4 * CMSIS-style functionality to support dynamic vectors
bogdanm 13:0645d8841f51 5 */
bogdanm 13:0645d8841f51 6 #include "cmsis_nvic.h"
bogdanm 13:0645d8841f51 7
bogdanm 13:0645d8841f51 8 #define NVIC_NUM_VECTORS (16 + 33) // CORE + MCU Peripherals
bogdanm 13:0645d8841f51 9 #define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Location of vectors in RAM
bogdanm 13:0645d8841f51 10 #define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash
bogdanm 13:0645d8841f51 11
bogdanm 13:0645d8841f51 12 void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) {
bogdanm 13:0645d8841f51 13 uint32_t *vectors = (uint32_t*)SCB->VTOR;
bogdanm 13:0645d8841f51 14 uint32_t i;
bogdanm 13:0645d8841f51 15
bogdanm 13:0645d8841f51 16 // Copy and switch to dynamic vectors if the first time called
bogdanm 13:0645d8841f51 17 if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) {
bogdanm 13:0645d8841f51 18 uint32_t *old_vectors = vectors;
bogdanm 13:0645d8841f51 19 vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS;
bogdanm 13:0645d8841f51 20 for (i=0; i<NVIC_NUM_VECTORS; i++) {
bogdanm 13:0645d8841f51 21 vectors[i] = old_vectors[i];
bogdanm 13:0645d8841f51 22 }
bogdanm 13:0645d8841f51 23 SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS;
bogdanm 13:0645d8841f51 24 }
bogdanm 13:0645d8841f51 25 vectors[IRQn + 16] = vector;
bogdanm 13:0645d8841f51 26 }
bogdanm 13:0645d8841f51 27
bogdanm 13:0645d8841f51 28 uint32_t NVIC_GetVector(IRQn_Type IRQn) {
bogdanm 13:0645d8841f51 29 uint32_t *vectors = (uint32_t*)SCB->VTOR;
bogdanm 13:0645d8841f51 30 return vectors[IRQn + 16];
bogdanm 13:0645d8841f51 31 }
bogdanm 13:0645d8841f51 32