diff --git a/examples/template_configuration/FreeRTOSConfig.h b/examples/template_configuration/FreeRTOSConfig.h index 5521adb4d3..da1ad8a286 100644 --- a/examples/template_configuration/FreeRTOSConfig.h +++ b/examples/template_configuration/FreeRTOSConfig.h @@ -653,7 +653,7 @@ #define INCLUDE_uxTaskPriorityGet 1 #define INCLUDE_vTaskDelete 1 #define INCLUDE_vTaskSuspend 1 -#define INCLUDE_vTaskDelayUntil 1 +#define INCLUDE_xTaskDelayUntil 1 #define INCLUDE_vTaskDelay 1 #define INCLUDE_xTaskGetSchedulerState 1 #define INCLUDE_xTaskGetCurrentTaskHandle 1 diff --git a/portable/MPLAB/PIC32MZ/port.c b/portable/MPLAB/PIC32MZ/port.c index 4af1fb832c..9d179335e3 100644 --- a/portable/MPLAB/PIC32MZ/port.c +++ b/portable/MPLAB/PIC32MZ/port.c @@ -219,6 +219,7 @@ static void prvTaskExitError( void ) portDISABLE_INTERRUPTS(); for( ;; ); } + /*-----------------------------------------------------------*/ /* @@ -372,3 +373,25 @@ void vPortClearInterruptMaskFromISR( UBaseType_t uxSavedStatusRegister ) #endif /* __mips_hard_float == 1 */ /*-----------------------------------------------------------*/ + +portFORCE_INLINE BaseType_t xPortIsInsideInterrupt( void ) +{ + uint32_t ulCurrentInterrupt; + BaseType_t xReturn; + + /* Obtain the number of the currently executing interrupt. */ + __asm volatile("mfc0 %0, $12" : "=r" (ulCurrentInterrupt)); + + if( ( ulCurrentInterrupt && portEXL_BIT ) != 0U ) + { + xReturn = pdFALSE; + } + else + { + xReturn = pdTRUE; + } + + return xReturn; +} + +/*-----------------------------------------------------------*/ diff --git a/portable/MPLAB/PIC32MZ/portmacro.h b/portable/MPLAB/PIC32MZ/portmacro.h index 8b04970865..6401739429 100644 --- a/portable/MPLAB/PIC32MZ/portmacro.h +++ b/portable/MPLAB/PIC32MZ/portmacro.h @@ -146,6 +146,8 @@ extern void vPortClearInterruptMaskFromISR( UBaseType_t ); #define portSET_INTERRUPT_MASK_FROM_ISR() uxPortSetInterruptMaskFromISR() #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusRegister ) vPortClearInterruptMaskFromISR( uxSavedStatusRegister ) +extern BaseType_t xPortIsInsideInterrupt( void ); + #if ( __mips_hard_float == 0 ) && ( configUSE_TASK_FPU_SUPPORT == 1 ) #error configUSE_TASK_FPU_SUPPORT can only be set to 1 when the part supports a hardware FPU module. #endif @@ -221,6 +223,10 @@ extern volatile UBaseType_t uxInterruptNesting; #define portREMOVE_STATIC_QUALIFIER #endif +#ifndef portFORCE_INLINE + #define portFORCE_INLINE __attribute__( ( always_inline ) ) +#endif + /* *INDENT-OFF* */ #ifdef __cplusplus }