Some checks failed
Basic Checks / license-check (push) Has been cancelled
Basic Checks / include-check (push) Has been cancelled
Basic Checks / style-check (push) Has been cancelled
Basic Checks / docs-check (push) Has been cancelled
Basic Checks / python-tests (push) Has been cancelled
Basic Checks / pin-validation (push) Has been cancelled
Basic Checks / cmake-checks (push) Has been cancelled
Basic Checks / frozen-tools-check (push) Has been cancelled
Publish or Update docker image for head of branch / prepare-tags (push) Has been cancelled
Release or update docker image for a released mbed-os version / prepare-tags (push) Has been cancelled
Publish or Update docker image for head of branch / build-container (push) Has been cancelled
Publish or Update docker image for head of branch / test-container (linux/amd64) (push) Has been cancelled
Publish or Update docker image for head of branch / test-container (linux/arm64) (push) Has been cancelled
Publish or Update docker image for head of branch / deploy-container (push) Has been cancelled
Release or update docker image for a released mbed-os version / build-container (push) Has been cancelled
Release or update docker image for a released mbed-os version / test-container (linux/amd64) (push) Has been cancelled
Release or update docker image for a released mbed-os version / test-container (linux/arm64) (push) Has been cancelled
Release or update docker image for a released mbed-os version / deploy-container (push) Has been cancelled
Prune temporary docker images / prune-images (push) Has been cancelled
44 lines
1.4 KiB
C
44 lines
1.4 KiB
C
/* mbed Microcontroller Library
|
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
******************************************************************************
|
|
*
|
|
* Copyright (c) 2015-2020 STMicroelectronics.
|
|
* All rights reserved.
|
|
*
|
|
* This software component is licensed by ST under BSD 3-Clause license,
|
|
* the "License"; You may not use this file except in compliance with the
|
|
* License. You may obtain a copy of the License at:
|
|
* opensource.org/licenses/BSD-3-Clause
|
|
*
|
|
******************************************************************************
|
|
*/
|
|
|
|
#include "cmsis.h"
|
|
#include "nvic_addr.h"
|
|
|
|
#define NVIC_USER_IRQ_OFFSET 16
|
|
|
|
void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
|
|
{
|
|
int i;
|
|
|
|
// Copy and switch to dynamic vectors if first time called
|
|
if ((SYSCFG->CFGR1 & SYSCFG_CFGR1_MEM_MODE) != SYSCFG_CFGR1_MEM_MODE) {
|
|
uint32_t *old_vectors = (uint32_t *)NVIC_FLASH_VECTOR_ADDRESS;
|
|
for (i = 0; i < NVIC_NUM_VECTORS; i++) {
|
|
*((uint32_t *)(NVIC_RAM_VECTOR_ADDRESS + (i * 4))) = old_vectors[i];
|
|
}
|
|
SYSCFG->CFGR1 |= SYSCFG_CFGR1_MEM_MODE; // Embedded SRAM mapped at 0x00000000
|
|
}
|
|
|
|
// Set the vector
|
|
*((uint32_t *)(NVIC_RAM_VECTOR_ADDRESS + (IRQn * 4) + (NVIC_USER_IRQ_OFFSET * 4))) = vector;
|
|
}
|
|
|
|
uint32_t NVIC_GetVector(IRQn_Type IRQn)
|
|
{
|
|
uint32_t *vectors = (uint32_t *)NVIC_RAM_VECTOR_ADDRESS;
|
|
// Return the vector
|
|
return vectors[IRQn + 16];
|
|
}
|