diff --git a/targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/cmsis_nvic.c b/targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/cmsis_nvic.c deleted file mode 100644 index 2ebd17c580..0000000000 --- a/targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/cmsis_nvic.c +++ /dev/null @@ -1,44 +0,0 @@ -/* mbed Microcontroller Library - * CMSIS-style functionality to support dynamic vectors - ****************************************************************************** - * Copyright (c) 2013-2016 Realtek Semiconductor Corp. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - ******************************************************************************/ - -#include "cmsis_nvic.h" - -#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Vectors positioned at start of RAM -#define NVIC_ROM_VECTOR_ADDRESS (0x00000000) // Initial vector position at start of ROM - -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector) { - uint32_t *vectors = (uint32_t *)SCB->VTOR; - uint32_t i; - - // Copy and switch to dynamic vectors if the first time called - if (SCB->VTOR != NVIC_RAM_VECTOR_ADDRESS) { - uint32_t *old_vectors = vectors; - vectors = (uint32_t*)NVIC_RAM_VECTOR_ADDRESS; - for (i=0; iVTOR = (uint32_t)NVIC_RAM_VECTOR_ADDRESS; - } - vectors[IRQn + NVIC_USER_IRQ_OFFSET] = vector; -} - -uint32_t NVIC_GetVector(IRQn_Type IRQn) { - uint32_t *vectors = (uint32_t*)SCB->VTOR; - return vectors[IRQn + NVIC_USER_IRQ_OFFSET]; -} diff --git a/targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/cmsis_nvic.h b/targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/cmsis_nvic.h index 7e047d8e9e..9aaf764870 100644 --- a/targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/cmsis_nvic.h +++ b/targets/TARGET_Realtek/TARGET_AMEBA/TARGET_RTL8195A/device/cmsis_nvic.h @@ -20,23 +20,17 @@ #ifndef MBED_CMSIS_NVIC_H #define MBED_CMSIS_NVIC_H +#define NVIC_RAM_VECTOR_ADDRESS (0x10000000) // Vectors positioned at start of RAM +#define NVIC_ROM_VECTOR_ADDRESS (0x00000000) // Initial vector position at start of ROM + // CORE: 64 vectors = 64 bytes from 0x00 to 0x3F // MCU Peripherals: 85 vectors = 340 bytes from 0x40 to ... // Total: 128 vectors = 512 bytes (0x200) to be reserved in RAM #define NVIC_NUM_VECTORS 128 +#ifndef NVIC_USER_IRQ_OFFSET #define NVIC_USER_IRQ_OFFSET 64 +#endif #include "cmsis.h" -#ifdef __cplusplus -extern "C" { -#endif - -void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector); -uint32_t NVIC_GetVector(IRQn_Type IRQn); - -#ifdef __cplusplus -} -#endif - #endif