下载 FreeRTOS
 

出色的 RTOS & 嵌入式软件

内核
最新资讯
FreeRTOS-Plus-TCP 现具有统一的 IPv4 和 IPv6 功能,支持多接口。
为基于 FreeRTOS 的固件实现防砖化 MCU FOTA:
宣布停止支持 FreeRTOS 202012 LTS。
FreeRTOS 网站现已提供简体中文版本
新的 FreeRTOS Long Term Support 版本现已发布。

xTaskCatchUpTicks
[RTOS 内核控制]

task.h  
BaseType_t xTaskCatchUpTicks( TickType_t xTicksToCatchUp );
在应用程序代码长时间禁用中断后, 更正滴答计数值。 此函数与 vTaskStepTick() 类似, 但与 vTaskStepTick() 不同的是,此函数可以增加滴答计数, 使其超过应将任务从阻塞态中移除的时间。这意味着 xTaskCatchUpTicks() 可从 阻塞态中移除任务。
参数:
xTicksToCatchUp 由于中断被禁用而错过的滴答中断数。 此值不会自动计算, 必须由应用程序编写者计算。
返回:
如果增加滴答计数,任务会解除阻塞态并执行上下文切换, 则返回 pdTRUE。 否则返回 pdFALSE。
用法示例:
 
void vExampleFunction( void )
{
    unsigned long ulTimeBefore, ulTimeAfter;

    /* Read the current time before arbitrary processing takes place. */
    ulTimeBefore = ulGetExternalTime();

    /* Stop the timer that is generating the tick interrupt. */
    prvStopTickInterruptTimer();
 
    /* Perform some arbitrary processing. */
    arbitrary_processing();
    
    /* Read the current time for computing elapsed time since ticks 
    were disabled. */
    ulTimeAfter = ulGetExternalTime();

    if ( xTaskCatchUpTicks( ulTimeAfter - ulTimeBefore ) == pdTRUE ) 
    {
        /* Moving the tick count forward resulted in a context switch. */
    }
    
    /* Restart the timer that is generating the tick interrupt. */
    prvStartTickInterruptTimer();

}





Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.