/** * Copyright (c) 2014 - 2017, Nordic Semiconductor ASA * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistributions in binary form, except as embedded into a Nordic * Semiconductor ASA integrated circuit in a product or a software update for * such product, must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other * materials provided with the distribution. * * 3. Neither the name of Nordic Semiconductor ASA nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * 4. This software, with or without modification, must only be used with a * Nordic Semiconductor ASA integrated circuit. * * 5. Any software provided in binary form under this license must not be reverse * engineered, decompiled, modified and/or disassembled. * * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef NRF_SOC_H__ #define NRF_SOC_H__ #include #include "nrf.h" #ifdef __cplusplus extern "C" { #endif /**@brief Enable External Interrupt. * @note Corresponds to NVIC_EnableIRQ in CMSIS. * * @pre{IRQn is valid and not reserved by the stack} * * @param[in] IRQn See the NVIC_EnableIRQ documentation in CMSIS. * * @retval ::NRF_SUCCESS The interrupt was enabled. */ uint32_t sd_nvic_EnableIRQ(IRQn_Type IRQn); /**@brief Disable External Interrupt. * @note Corresponds to NVIC_DisableIRQ in CMSIS. * * @pre{IRQn is valid and not reserved by the stack} * * @param[in] IRQn See the NVIC_DisableIRQ documentation in CMSIS * * @retval ::NRF_SUCCESS The interrupt was disabled. */ uint32_t sd_nvic_DisableIRQ(IRQn_Type IRQn); /**@brief Get Pending Interrupt. * @note Corresponds to NVIC_GetPendingIRQ in CMSIS. * * @pre{IRQn is valid and not reserved by the stack} * * @param[in] IRQn See the NVIC_GetPendingIRQ documentation in CMSIS. * @param[out] p_pending_irq Return value from NVIC_GetPendingIRQ. * * @retval ::NRF_SUCCESS The interrupt is available for the application. */ uint32_t sd_nvic_GetPendingIRQ(IRQn_Type IRQn, uint32_t * p_pending_irq); /**@brief Set Pending Interrupt. * @note Corresponds to NVIC_SetPendingIRQ in CMSIS. * * @pre{IRQn is valid and not reserved by the stack} * * @param[in] IRQn See the NVIC_SetPendingIRQ documentation in CMSIS. * * @retval ::NRF_SUCCESS The interrupt is set pending. */ uint32_t sd_nvic_SetPendingIRQ(IRQn_Type IRQn); /**@brief Clear Pending Interrupt. * @note Corresponds to NVIC_ClearPendingIRQ in CMSIS. * * @pre{IRQn is valid and not reserved by the stack} * * @param[in] IRQn See the NVIC_ClearPendingIRQ documentation in CMSIS. * * @retval ::NRF_SUCCESS The interrupt pending flag is cleared. */ uint32_t sd_nvic_ClearPendingIRQ(IRQn_Type IRQn); /**@brief Set Interrupt Priority. * @note Corresponds to NVIC_SetPriority in CMSIS. * * @pre{IRQn is valid and not reserved by the stack} * @pre{priority is valid and not reserved by the stack} * * @param[in] IRQn See the NVIC_SetPriority documentation in CMSIS. * @param[in] priority A valid IRQ priority for use by the application. * * @retval ::NRF_SUCCESS The interrupt and priority level is available for the application. */ uint32_t sd_nvic_SetPriority(IRQn_Type IRQn, uint32_t priority); /**@brief Get Interrupt Priority. * @note Corresponds to NVIC_GetPriority in CMSIS. * * @pre{IRQn is valid and not reserved by the stack} * * @param[in] IRQn See the NVIC_GetPriority documentation in CMSIS. * @param[out] p_priority Return value from NVIC_GetPriority. * * @retval ::NRF_SUCCESS The interrupt priority is returned in p_priority. */ uint32_t sd_nvic_GetPriority(IRQn_Type IRQn, uint32_t * p_priority); /**@brief System Reset. * @note Corresponds to NVIC_SystemReset in CMSIS. * * @retval ::NRF_ERROR_SOC_NVIC_SHOULD_NOT_RETURN */ uint32_t sd_nvic_SystemReset(void); /**@brief Enters critical region. * * @post Application interrupts will be disabled. * @sa sd_nvic_critical_region_exit * * @param[out] p_is_nested_critical_region 1: If in a nested critical region. * 0: Otherwise. * * @retval ::NRF_SUCCESS */ uint32_t sd_nvic_critical_region_enter(uint8_t * p_is_nested_critical_region); /**@brief Exit critical region. * * @pre Application has entered a critical region using ::sd_nvic_critical_region_enter. * @post If not in a nested critical region, the application interrupts will restored to the state before ::sd_nvic_critical_region_enter was called. * * @param[in] is_nested_critical_region If this is set to 1, the critical region won't be exited. @sa sd_nvic_critical_region_enter. * * @retval ::NRF_SUCCESS */ uint32_t sd_nvic_critical_region_exit(uint8_t is_nested_critical_region); #ifdef __cplusplus } #endif #endif /* NRF_SOC_H__ */