Ucos3 idle task

Source: Internet
Author: User

Author: jcy

QQ: 1501614847

JCY-JCY (csdn)

From the electronic innovation lab of Suzhou college, Anhui province, grade 09

In this article, we are very grateful for your understanding of ucos3's idle space!

All content in this article is personal opinion and does not represent any institution!

 

I have also analyzedUcos2Source codeUcos2Objects used inUcos2How to perform the parsing from the source code level. In fact, in the embedded real-time operating systemUC/os2This book also describes how objects run in the kernel and how objects operate functions.Code. However, I explained a specific processor at the source code level, for example, how to implement Scheduling in assembly code, and analyzed every statement in assembly code. Some may ask, since the operating system kernel provides a lot of interface functions for users to call, why should we know how the kernel source code implements various management functions. Here, I personally think that understanding the source code of the operating system kernel allows us to write applications.ProgramBe sure to know why the parameter attributes of some interface functions are so well known. More importantly, we have learned that the internal data structure of the operating system kernel can help improve the level of our designed applications, becauseUcos2Some data structures used inAlgorithmThe execution speed and efficiency are very fast.

 

 

PreviousArticleI have also writtenUcos2From the source code level. This is not explained here. First, I want to see the following:Ucos3I personally feel that this step is suitable for reading the Operating SystemUcos3Source code.

1. Buy a storyUcos3The operating system principle book, which can be downloaded to the English and Chinese versions on the Internet. Although the English version of the original author, reading was slow at that time. Why are there ready-made Chinese resources! After all, Chinese is our mother tongue. It is easy to understand and fast to read. This book introduces the basic concepts of embedded systems, but most importantly, it describes kernel scheduling and object operating principles. Many graphic data streams allow us to quickly understand the data structure of the kernel.

Second, I started to read the source code.UC/os2First, start from the deepest kernel scheduling. The specific process is as follows:

kernel scheduling Source Code -> task operation source code -> idle task operation source code -> statistical task operation source code -> semaphore Source Code -> mutex semaphore Source Code -> message source code -> Message Queue Source Code -> event flag Source Code .

Because the timer function is available in the latest version.,So I read the implementation source code of the timer..

ForUcos3The source code is reversed.

idle task Source Code -> tick task Source Code -> latency task Source Code -> timer task Source Code -> source code of an interrupted queue task -> semaphore Source Code -> mutex semaphore Source Code -> Message Queue Source Code -> task Source Code -> kernel scheduling Source Code

This is only my personal source code viewing process. It may not be suitable for everyone, but it is my greatest pleasure to help you.

 

The starting point of the idle task, and the idle task is inUcos3It is the simplest task in the operating system and does very little work. It is mainly used for auto-increment of idle counter loops and Statistics Task counter loops (howUcos3). Idle tasks are inUcos3Required in the operating system, with instructionsCPUThe user code is not executed in idle state.

I start from the initialization of the statistics task.Ucos3The creation process of idle tasks. To use an operating system in an application, you must call the initialization interface of the operating system.Ucos3The most basic initialization work. The Interface Definition prototype of this function is as follows:

Void osinit (OS _err * p_err)

in this function, only idle tasks are involved. The Code is as follows:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.