We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents d9d2e73 + ae9e4aa commit 2e535f7Copy full SHA for 2e535f7
1 file changed
CMSIS/RTOS2/FreeRTOS/Source/cmsis_os2.c
@@ -831,7 +831,7 @@ osStatus_t osDelay (uint32_t ticks) {
831
}
832
833
osStatus_t osDelayUntil (uint32_t ticks) {
834
- TickType_t tcnt;
+ TickType_t tcnt, delay;
835
osStatus_t stat;
836
837
if (IS_IRQ()) {
@@ -840,8 +840,17 @@ osStatus_t osDelayUntil (uint32_t ticks) {
840
else {
841
stat = osOK;
842
tcnt = xTaskGetTickCount();
843
+ delay = (TickType_t)ticks - tcnt;
844
- vTaskDelayUntil (&tcnt, (TickType_t)(ticks - tcnt));
845
+ /* check if target tick has not expired */
846
+ if(delay && 0 == (delay >> (8 * sizeof(TickType_t) - 1))){
847
+ vTaskDelayUntil (&tcnt, delay));
848
+ }
849
+ else
850
+ {
851
+ /* No delay or already expired */
852
+ stat = osErrorParameter;
853
854
855
856
return (stat);
0 commit comments