File tree Expand file tree Collapse file tree
CMSIS/RTOS2/FreeRTOS/Source Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -136,6 +136,16 @@ void *__user_perthread_libspace (void) {
136136
137137#ifndef RTE_CMSIS_Compiler_OS_Interface_RTOS2_LOCKS
138138
139+ #if (__ARM_ARCH_7A__ == 1U )
140+ /* CPSR mode bitmasks */
141+ #define CPSR_MODE_USER 0x10U
142+ #define CPSR_MODE_SYSTEM 0x1FU
143+
144+ #define IS_IRQ_MODE () ((__get_mode() != CPSR_MODE_USER) && (__get_mode() != CPSR_MODE_SYSTEM))
145+ #else
146+ #define IS_IRQ_MODE () (__get_IPSR() != 0U)
147+ #endif
148+
139149/* Define the number of Mutexes used by standard C/C++ library for stream protection */
140150#ifndef OS_MUTEX_CLIB_NUM
141151 #define OS_MUTEX_CLIB_NUM 5
@@ -156,7 +166,7 @@ __USED void _mutex_free (mutex *m);
156166
157167/* Check if processor is in Thread or Handler mode */
158168static uint32_t is_thread_mode (void ) {
159- if (__get_IPSR () == 0U ) {
169+ if (IS_IRQ_MODE () != 0 ) {
160170 return 1U ; /* Thread mode */
161171 } else {
162172 return 0U ; /* Handler mode */
You can’t perform that action at this time.
0 commit comments