File tree Expand file tree Collapse file tree 6 files changed +341
-235
lines changed
Expand file tree Collapse file tree 6 files changed +341
-235
lines changed Original file line number Diff line number Diff line change 168168
169169 #else /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
170170
171- /* Ensure API functions go in the privileged execution section. */
171+ /* Ensure API functions go in the privileged execution section. */
172172 #define PRIVILEGED_FUNCTION __attribute__( ( section( "privileged_functions" ) ) )
173173 #define PRIVILEGED_DATA __attribute__( ( section( "privileged_data" ) ) )
174174 #define FREERTOS_SYSTEM_CALL __attribute__( ( section( "freertos_system_calls" ) ) )
175175
176+ /**
177+ * @brief Calls the port specific code to raise the privilege.
178+ *
179+ * Sets xRunningPrivileged to pdFALSE if privilege was raised, else sets
180+ * it to pdTRUE.
181+ */
182+ #define xPortRaisePrivilege ( xRunningPrivileged ) \
183+ { \
184+ /* Check whether the processor is already privileged. */ \
185+ xRunningPrivileged = portIS_PRIVILEGED (); \
186+ \
187+ /* If the processor is not already privileged, raise privilege. */ \
188+ if ( xRunningPrivileged == pdFALSE ) \
189+ { \
190+ portRAISE_PRIVILEGE (); \
191+ } \
192+ }
193+
194+ /**
195+ * @brief If xRunningPrivileged is not pdTRUE, calls the port specific
196+ * code to reset the privilege, otherwise does nothing.
197+ */
198+ #define vPortResetPrivilege ( xRunningPrivileged ) \
199+ { \
200+ if( xRunningPrivileged == pdFALSE ) \
201+ { \
202+ portRESET_PRIVILEGE(); \
203+ } \
204+ }
205+
176206 #endif /* MPU_WRAPPERS_INCLUDED_FROM_API_FILE */
177207
178208#else /* portUSING_MPU_WRAPPERS */
You can’t perform that action at this time.
0 commit comments