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