From 63204dc5ee09b79664ad7000b87dda5e175d81ad Mon Sep 17 00:00:00 2001 From: Kody Stribrny Date: Thu, 14 Apr 2022 12:56:50 -0700 Subject: [PATCH] Add atomic flag for 16-bit ticks This change allows the PIC24 family of 16 bit processors to read the tick count without a critical section when the tick count is also 16 bits. Inspired from discussion - https://forums.freertos.org/t/xtaskgettickcount-with-critical-section-on-16-bit-mcu/14860/5 --- portable/MPLAB/PIC24_dsPIC/portmacro.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/portable/MPLAB/PIC24_dsPIC/portmacro.h b/portable/MPLAB/PIC24_dsPIC/portmacro.h index 223e4936b2..0974bc33b8 100644 --- a/portable/MPLAB/PIC24_dsPIC/portmacro.h +++ b/portable/MPLAB/PIC24_dsPIC/portmacro.h @@ -59,6 +59,9 @@ typedef unsigned short UBaseType_t; #if( configUSE_16_BIT_TICKS == 1 ) typedef uint16_t TickType_t; #define portMAX_DELAY ( TickType_t ) 0xffff +/* 16-bit tick type on a 16-bit architecture, so reads of the tick count do + * not need to be guarded with a critical section. */ + #define portTICK_TYPE_IS_ATOMIC 1 #else typedef uint32_t TickType_t; #define portMAX_DELAY ( TickType_t ) 0xffffffffUL