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

How to analyze the accuracy of SylixOS ordinary timer

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

How to analyze the accuracy of SylixOS ordinary timer? in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

1. Scope of application

The functions of high precision timer and ordinary timer are realized under SylixOS. This document introduces the accuracy of ordinary timer, which is suitable for SylixOS development engineers. Users should have basic knowledge of SylixOS and basic programming ability.

two。 Realization principle

When creating a timer in the application layer under SylixOS, the system will apply for the timer control block. When starting the timer, the timer control block will be added to the global scan list, and the kernel thread will be responsible for the cyclic scan queue. The code module is shown in listing 2.1of the program.

Listing 2.1 timer kernel thread

... ... (omit) for (;;) {PLW_CLASS_WAKEUP_NODE pwun; ULONG ulCounter = LW_ITIMER_RATE; # if (LW_CFG_RMS_EN > 0) & & (LW_CFG_MAX_RMSS > 0) API_RmsPeriod (ulRms, LW_ITIMER_RATE); / * run periodically using RMS * / # else API_TimeSleep (LW_ITIMER_RATE) / * wait for a scan cycle * / # endif... ... (omit)}. ... (omitted)

As you can see from listing 2.1, the time period of the kernel thread loop is controlled by RMS scheduling, and the time period is:

LW_ITIMER_RATE

Under SylixOS, LW_ITIMER_RATE is defined as:

# define LW_ITIMER_RATE _ K_timingKernel.TIMING_ulITimerRate

_ K_timingKernel is defined as (take ARM CortexA9 base as an example):

_ K_timingKernel = {100,100,100,5,1,10, LW_CFG_SLICE_DEFAULT}

Therefore, the timer accuracy under SylixOS depends on the system Tick. Taking the above system Tick as an example, the timer thread traversal cycle is 5 system Tick, that is, the timer accuracy is 50 ms.

This is the answer to the question about how to analyze the accuracy of SylixOS general timer. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

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

Development

Wechat

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

12
Report