1 //***************************************************************************** 2 // 3 //! @file am_hal_interrupt.h 4 //! 5 //! @brief Helper functions supporting interrupts and NVIC operation. 6 //! 7 //! These functions may be used for NVIC-level interrupt configuration. 8 //! 9 //! @addtogroup interrupt3 Interrupt - ARM NVIC support functions 10 //! @ingroup apollo3_hal 11 //! @{ 12 // 13 //***************************************************************************** 14 15 //***************************************************************************** 16 // 17 // Copyright (c) 2024, Ambiq Micro, Inc. 18 // All rights reserved. 19 // 20 // Redistribution and use in source and binary forms, with or without 21 // modification, are permitted provided that the following conditions are met: 22 // 23 // 1. Redistributions of source code must retain the above copyright notice, 24 // this list of conditions and the following disclaimer. 25 // 26 // 2. Redistributions in binary form must reproduce the above copyright 27 // notice, this list of conditions and the following disclaimer in the 28 // documentation and/or other materials provided with the distribution. 29 // 30 // 3. Neither the name of the copyright holder nor the names of its 31 // contributors may be used to endorse or promote products derived from this 32 // software without specific prior written permission. 33 // 34 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 35 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 36 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 37 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 38 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 39 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 40 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 41 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 42 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 43 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 44 // POSSIBILITY OF SUCH DAMAGE. 45 // 46 // This is part of revision release_sdk_3_2_0-dd5f40c14b of the AmbiqSuite Development Package. 47 // 48 //***************************************************************************** 49 #ifndef AM_HAL_INTERRUPT_H 50 #define AM_HAL_INTERRUPT_H 51 52 #ifdef __cplusplus 53 extern "C" 54 { 55 #endif 56 57 // 58 //! Define the last peripheral interrupt as AM_HAL_INTERRUPT_MAX. 59 //! The total number of interrupts in the vector table is therefore 60 //! (AM_HAL_INTERRUPT_MAX + 1 + 16). 61 // 62 #define AM_HAL_INTERRUPT_MAX (CLKGEN_IRQn) 63 64 65 //***************************************************************************** 66 //! @brief disable all interrupts 67 //! @details CPSID i sets PRIMASK.PM to 1 68 //! 69 //! @return uint32_t 70 //***************************************************************************** 71 extern uint32_t am_hal_interrupt_master_disable(void); 72 //***************************************************************************** 73 //! @brief enable all interrupts 74 //! @details CPSIE i sets PRIMASK.PM to 0 75 //! 76 //! @return uint32_t 77 //***************************************************************************** 78 extern uint32_t am_hal_interrupt_master_enable(void); 79 //***************************************************************************** 80 //! @brief set primask 81 //! 82 //! @param ui32InterruptState set primask to this value 83 //***************************************************************************** 84 extern void am_hal_interrupt_master_set(uint32_t ui32InterruptState); 85 86 #ifdef __cplusplus 87 } 88 #endif 89 90 #endif // AM_HAL_INTERRUPT_H 91 92 //***************************************************************************** 93 // 94 // End Doxygen group. 95 //! @} 96 // 97 //***************************************************************************** 98