2 * FreeRTOS Kernel V11.2.0
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: MIT
7 * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
29 #ifndef __PORT_ASM_H__
30 #define __PORT_ASM_H__
32 /* Scheduler includes. */
35 /* MPU wrappers includes. */
36 #include "mpu_wrappers.h"
39 * @brief Restore the context of the first task so that the first task starts
42 void vRestoreContextOfFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
45 * @brief Checks whether or not the processor is privileged.
47 * @return 1 if the processor is already privileged, 0 otherwise.
49 BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) );
52 * @brief Raises the privilege level by clearing the bit 0 of the CONTROL
55 * @note This is a privileged function and should only be called from the kernel
58 * Bit 0 of the CONTROL register defines the privilege level of Thread Mode.
59 * Bit[0] = 0 --> The processor is running privileged
60 * Bit[0] = 1 --> The processor is running unprivileged.
62 void vRaisePrivilege( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
65 * @brief Lowers the privilege level by setting the bit 0 of the CONTROL
68 * Bit 0 of the CONTROL register defines the privilege level of Thread Mode.
69 * Bit[0] = 0 --> The processor is running privileged
70 * Bit[0] = 1 --> The processor is running unprivileged.
72 void vResetPrivilege( void ) __attribute__( ( naked ) );
75 * @brief Starts the first task.
77 void vStartFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
80 * @brief Disables interrupts.
82 uint32_t ulSetInterruptMask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
85 * @brief Enables interrupts.
87 void vClearInterruptMask( uint32_t ulMask ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
90 * @brief PendSV Exception handler.
92 void PendSV_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
97 void SVC_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
99 #endif /* __PORT_ASM_H__ */