Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the timing / delay mechanisms commonly used in VxWorks

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces which timing / delay mechanisms are commonly used in VxWorks. It is very detailed and has certain reference value. Friends who are interested must finish reading it.

Timing / delay mechanisms commonly used in VxWorks

TaskDelay ()

Sleep () / nanosleep ()

WatchDog

Auxiliary Clock

Timestamp

TaskDelay ()

When ticks is 0-moves the current task (executing in the ready queue) to the end of the task of the same priority (still in the ready queue)

When ticks is n (greater than 0)-moves the current task (executing in the ready queue) to the deferred queue and moves it back to the ready queue when the nth tick of the system clock is encountered. Therefore, the actual delay duration is (nmur1, n) tick, that is to say, taskDelay () has an error of 0-1 tick.

If the task is in the delay queue, if it encounters a non-blocking, non-negligible signal,taskDelay (), it returns ERROR and sets ERRNO to EINTR.

When a task returns to the ready queue, there may be high (or equivalent) priority tasks ahead, so the delay time may be longer

Sleep () / nanosleep ()

These are POSIX standard functions, which are also delay operations, which move the current task to the delay queue, and the bottom layer is the called taskDelay (), that is, its precision also depends on the system clock. Unlike taskDelay (),

The parameter is time.

When rmtp is not NULL-used to store the remaining time of sleep () / nanosleep () due to the early return of signal

When the timer is 0 (secs=0;rqtp- > tv_sec=rqtp- > tv_nsec=0)-do nothing

Timing is not 0 hours-delay at least parameter length (rounded up, cardinality is system clock) plus 1 system clock tick

As you can see, if sleep is 1 second, the result is 1 second plus 1 tick, which prevents the error of taskDelay () that is less than 1 tick.

Nanosleep () also operates in this way:

When each tick of the system clock is 1 millisecond, nanosleep () 1 nanosecond is actually rounded up to 1 millisecond (base is 1 millisecond of tick) plus 1 tick (1 millisecond), that is, 2 milliseconds. When nanosleep () is slightly more than 1 millisecond (for example, 1000001), it is actually rounded up (2 milliseconds) plus one tick (1 millisecond), that is, 3 milliseconds.

WatchDog

Its timing accuracy also depends on the system clock, but the difference from taskDelay () / sleep () / nanosleep () is that the operation after WatchDog timing is performed in the form of an interrupt and will not be disturbed by other high-priority tasks.

Auxiliary Clock

Timing accuracy can be much higher than that of WatchDog, and timing is periodic.

Timestamp

Timing accuracy is the highest, up to nanosecond, but only polling mode is supported in most boards.

These are all the contents of this article entitled "what are the timing / delay mechanisms commonly used in VxWorks?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report