]> begriffs open source - cmsis-freertos/blob - CMSIS/RTOS2/FreeRTOS/Source/handlers.c
Correct memory allocation and access in osMemoryPoolNew (#142)
[cmsis-freertos] / CMSIS / RTOS2 / FreeRTOS / Source / handlers.c
1 /******************************************************************************
2  * @file     irq_handler.c
3  * @brief    CMSIS-FreeRTOS Interrupt Handler
4  * @version  9.1.0
5  * @date     11 Aug 2017
6  *
7  * @note
8  *
9  ******************************************************************************/
10 /*
11  * Copyright (c) 2017 Arm Limited. All rights reserved.
12  *
13  * SPDX-License-Identifier: Apache-2.0
14  *
15  * Licensed under the Apache License, Version 2.0 (the License); you may
16  * not use this file except in compliance with the License.
17  * You may obtain a copy of the License at
18  *
19  * www.apache.org/licenses/LICENSE-2.0
20  *
21  * Unless required by applicable law or agreed to in writing, software
22  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
23  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24  * See the License for the specific language governing permissions and
25  * limitations under the License.
26  */
27
28 #include <stddef.h>
29
30 #include "RTE_Components.h"
31 #include CMSIS_device_header
32 #include "irq_ctrl.h"
33
34 /* The function called by the RTOS port layer after it has managed interrupt
35 entry. */
36 void vApplicationIRQHandler( uint32_t ulICCIAR )
37 {
38   uint32_t ulInterruptID;
39   IRQHandler_t h;
40
41   /* Re-enable interrupts. */
42   __enable_irq();
43
44   /* The ID of the interrupt can be obtained by bitwise anding the ICCIAR value
45   with 0x3FF. */
46   ulInterruptID = ulICCIAR & 0x3FFUL;
47
48   /* Call the function installed in the array of installed handler functions. */
49   h = IRQ_GetHandler (ulInterruptID);
50
51   /* Call handler function */
52   if (h != NULL) {
53     h();
54   }
55 }