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