当前位置:网站首页>1281_ FreeRTOS_ Implementation analysis of vtaskdelayuntil

1281_ FreeRTOS_ Implementation analysis of vtaskdelayuntil

2022-06-25 23:02:00 grey_ csdn

All learning summary : GreyZhang/g_FreeRTOS: learning notes about FreeRTOS. (github.com)

I have made a brief analysis of vTaskDelay(), Analyze this time vTaskDelayUntil() The implementation of the . Before , I vaguely remember when I read the document vTaskDelayUntil() The delay that can be completed is more accurate . This time, , From a code design perspective, see why .

there pxPreviousWakeTime The implemented function is also a parameter passing function , What is passed in is a time benchmark . Of course , It is itself a pointer , What is passed in is not a numeric parameter . here , The key message is :1, The scheduler cannot suspend ; 2, Wake up time timing setting . it seems , The routine is the same as that analyzed before vTaskDelay() There is not much difference .

here , Distinguished tick If the timeout . In each case , Whether the delay time has reached . If you reach , Then you can directly request task scheduling .

Actually , The processing of this part is the same as that of the previous analysis vTaskDelay() The processing interface of is also very similar . Actually , The main way is to join delayed task The task scheduling request is triggered after the linked list .

that , What are the differences between the two interfaces ? Why do you say vTaskDelay() Not as good as vTaskDelayUntil() How about precision ? Actually , After reading the code, I can basically understand the difference between the two . If you understand the difference between the two , In fact, some clues can be seen from the interface form of the function . In fact, the delay implementation of the two interfaces is a continuous judgment after the timer sets a reference value , But the setting of this reference point is different .vTaskDelay() The set reference point always starts from the current , and vTaskDelayUntil() The setting of reference point can be specified .

This is a code example used , Actually , I think the functions of this example are similar to vTaskDelay() The functions implemented by the interface are not too different . Especially when When some high priority tasks are preempted . that , If there is a certain difference between the two interface implementations ? That must be the time when the reference point settings are constantly updated , There may be more flexible ways .

This is an analysis of the examples and an added comparison . Actually , Whether it's vTaskDelayUntil() still vTaskDelay(), If you continue to encounter long running and high priority tasks , Their accuracy will certainly be affected . After all, so far , I don't see any improvement in the priority of such tasks . From this point of view , The differences previously considered , Actually 2 Both interfaces are affected . After excluding such differences , The difference between the two interfaces can be understood as :vTaskDelay() The setting is actually time waiting , and vTaskDelayUntil() The implementation is to frame a time window .

原网站

版权声明
本文为[grey_ csdn]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206251913498211.html