]> begriffs open source - freertos/blob - portable/GCC/ARM_CM33_NTZ/non_secure/portasm.h
Add SMP in the License Header (#402)
[freertos] / portable / GCC / ARM_CM33_NTZ / non_secure / portasm.h
1 /*
2  * FreeRTOS SMP Kernel V202110.00
3  * Copyright (C) 2020 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * https://www.FreeRTOS.org
23  * https://github.com/FreeRTOS
24  *
25  * 1 tab == 4 spaces!
26  */
27
28 #ifndef __PORT_ASM_H__
29 #define __PORT_ASM_H__
30
31 /* Scheduler includes. */
32 #include "FreeRTOS.h"
33
34 /* MPU wrappers includes. */
35 #include "mpu_wrappers.h"
36
37 /**
38  * @brief Restore the context of the first task so that the first task starts
39  * executing.
40  */
41 void vRestoreContextOfFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
42
43 /**
44  * @brief Checks whether or not the processor is privileged.
45  *
46  * @return 1 if the processor is already privileged, 0 otherwise.
47  */
48 BaseType_t xIsPrivileged( void ) __attribute__( ( naked ) );
49
50 /**
51  * @brief Raises the privilege level by clearing the bit 0 of the CONTROL
52  * register.
53  *
54  * @note This is a privileged function and should only be called from the kenrel
55  * code.
56  *
57  * Bit 0 of the CONTROL register defines the privilege level of Thread Mode.
58  *  Bit[0] = 0 --> The processor is running privileged
59  *  Bit[0] = 1 --> The processor is running unprivileged.
60  */
61 void vRaisePrivilege( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
62
63 /**
64  * @brief Lowers the privilege level by setting the bit 0 of the CONTROL
65  * register.
66  *
67  * Bit 0 of the CONTROL register defines the privilege level of Thread Mode.
68  *  Bit[0] = 0 --> The processor is running privileged
69  *  Bit[0] = 1 --> The processor is running unprivileged.
70  */
71 void vResetPrivilege( void ) __attribute__( ( naked ) );
72
73 /**
74  * @brief Starts the first task.
75  */
76 void vStartFirstTask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
77
78 /**
79  * @brief Disables interrupts.
80  */
81 uint32_t ulSetInterruptMask( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
82
83 /**
84  * @brief Enables interrupts.
85  */
86 void vClearInterruptMask( uint32_t ulMask ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
87
88 /**
89  * @brief PendSV Exception handler.
90  */
91 void PendSV_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
92
93 /**
94  * @brief SVC Handler.
95  */
96 void SVC_Handler( void ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
97
98 /**
99  * @brief Allocate a Secure context for the calling task.
100  *
101  * @param[in] ulSecureStackSize The size of the stack to be allocated on the
102  * secure side for the calling task.
103  */
104 void vPortAllocateSecureContext( uint32_t ulSecureStackSize ) __attribute__( ( naked ) );
105
106 /**
107  * @brief Free the task's secure context.
108  *
109  * @param[in] pulTCB Pointer to the Task Control Block (TCB) of the task.
110  */
111 void vPortFreeSecureContext( uint32_t * pulTCB ) __attribute__( ( naked ) ) PRIVILEGED_FUNCTION;
112
113 #endif /* __PORT_ASM_H__ */