mbed library sources: Modified to operate FRDM-KL25Z at 48MHz from internal 32kHz oscillator (nothing else changed).
Fork of mbed-src by
The only file that changed is: mbed-src-FLL48/targets/cmsis/TARGET_Freescale/TARGET_KL25Z/system_MKL25Z4.h
targets/cmsis/TARGET_Freescale/TARGET_KL05Z/cmsis_nvic.c@20:4263a77256ae, 2013-09-10 (annotated)
- Committer:
- bogdanm
- Date:
- Tue Sep 10 15:14:19 2013 +0300
- Revision:
- 20:4263a77256ae
Sync with git revision 171dda705c947bf910926a0b73d6a4797802554d
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bogdanm | 20:4263a77256ae | 1 | /* mbed Microcontroller Library - cmsis_nvic for KL05Z |
bogdanm | 20:4263a77256ae | 2 | * Copyright (c) 2011 ARM Limited. All rights reserved. |
bogdanm | 20:4263a77256ae | 3 | * |
bogdanm | 20:4263a77256ae | 4 | * CMSIS-style functionality to support dynamic vectors |
bogdanm | 20:4263a77256ae | 5 | */ |
bogdanm | 20:4263a77256ae | 6 | #include "cmsis_nvic.h" |
bogdanm | 20:4263a77256ae | 7 | |
bogdanm | 20:4263a77256ae | 8 | #define NVIC_RAM_VECTOR_ADDRESS (0x1FFFFC00) // Vectors positioned at start of RAM |
bogdanm | 20:4263a77256ae | 9 | #define NVIC_FLASH_VECTOR_ADDRESS (0x0) // Initial vector position in flash |
bogdanm | 20:4263a77256ae | 10 | |
bogdanm | 20:4263a77256ae | 11 | void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) { |
bogdanm | 20:4263a77256ae | 12 | uint32_t *vectors = (uint32_t*)SCB->VTOR; |
bogdanm | 20:4263a77256ae | 13 | uint32_t i; |
bogdanm | 20:4263a77256ae | 14 | |
bogdanm | 20:4263a77256ae | 15 | // Copy and switch to dynamic vectors if the first time called |
bogdanm | 20:4263a77256ae | 16 | if (SCB->VTOR == NVIC_FLASH_VECTOR_ADDRESS) { |
bogdanm | 20:4263a77256ae | 17 | uint32_t *old_vectors = vectors; |
bogdanm | 20:4263a77256ae | 18 | vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS; |
bogdanm | 20:4263a77256ae | 19 | for (i=0; i<NVIC_NUM_VECTORS; i++) { |
bogdanm | 20:4263a77256ae | 20 | vectors[i] = old_vectors[i]; |
bogdanm | 20:4263a77256ae | 21 | } |
bogdanm | 20:4263a77256ae | 22 | SCB->VTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS; |
bogdanm | 20:4263a77256ae | 23 | } |
bogdanm | 20:4263a77256ae | 24 | vectors[IRQn + 16] = vector; |
bogdanm | 20:4263a77256ae | 25 | } |
bogdanm | 20:4263a77256ae | 26 | |
bogdanm | 20:4263a77256ae | 27 | uint32_t NVIC_GetVector(IRQn_Type IRQn) { |
bogdanm | 20:4263a77256ae | 28 | uint32_t *vectors = (uint32_t*)SCB->VTOR; |
bogdanm | 20:4263a77256ae | 29 | return vectors[IRQn + 16]; |
bogdanm | 20:4263a77256ae | 30 | } |