Rt-thread Kernel Object Flags flag summary

Source: Internet
Author: User

First, kernel flags flag

There is a flag member in the Kernel object control block flag (rt_uint8_t flag; ), this flag has different meanings in different kernel objects. The kernel objects of the rt-thread are timers, threads, semaphores, mutexes, events, mailboxes, message queues, memory heaps, devices, modules, which inherit the members of the kernel objects, which also contain the flag members of the kernel objects, so Kernel Object members flag in these different situations is specific to different meanings.

Ii. the definition of flag in the timer

#definert_timer_flag_deactivated 0x0/**< TIMER is deactive *///Timer not activated, i.e. initialization value#definert_timer_flag_activated 0x1/**< TIMER is active *///Timer Activated when the timer start will be set to this state#defineRt_timer_flag_one_shot 0x0/**< One SHOT TIMER *///single timer. That is, timer time one to automatic failure#defineRt_timer_flag_periodic 0x2/**< Periodic TIMER *///Cycle timer. That is, when the time is up, the next timer is automatically#defineRt_timer_flag_hard_timer 0x0/**< Hard timer,the TIMER ' s callback function'll be called on Tick is R. *///Hard clock. Hardware Timer Interrupt mode#defineRt_timer_flag_soft_timer 0x4/**< SOFT timer,the TIMER ' s callback function'll be called in TIMER t Hread. *///software clock. Software Timer Threading Mode

Iii. definition of flag in thread

The thread inherits the kernel object, but its data definition does not directly contain the kernel object struct variable member, but instead directly contains its members in the thread control block, as follows:

structrt_thread{/*RT Object*/    CharName[rt_name_max];/**< the name of thread*/rt_uint8_t type; /**< type of Object*/rt_uint8_t flags; /**< thread ' s flags*/#ifdef Rt_using_modulevoid*module_id;/**< ID of application module*/#endifrt_list_t list; /**< the object list*/rt_list_t tlist; /**< the thread list*/    ......

As defined by the inline control block, from the beginning to the list members are kept consistent with the kernel object, and as to why this is the case, it is estimated that the RTT author should have written the thread-related code very early, so it continues to this day. Notice that in the thread control block is the flags, one more s, This does not prevent it from inheriting from the kernel object control block, but the kernel object's flags do not seem to have much of a role in the kernel, as can be seen from the initialization interface function of the thread, without the use of the flags parameter, or from an external argument. It seems that the RTT author has forgotten it, or has not yet figured out how to use this parameter in the thread .

Iv. definition of flag in IPC

RTT in IPC objects in semaphores, mutexes, events, messages, message queues These are collectively referred to as IPC kernel objects. There are only two definitions of flag in these IPC kernel objects:

#define Rt_ipc_flag_fifo                0x00            /**< fifoed IPC. @ref IPC. *///perqueue FIFO . #define Rt_ipc_flag_prio                0x01            /**< prioed IPC. @ref IPC. *///per thread priority, that is, whichthread has a high priority, which is the first action.

V. Other

Flag is not used in the device, memory pool, or memory heap. Flag is useful in the module, and Bit0 is used as a flag with entry point or not.

Six, Rt-thread core summary

In the rtthread-2.0.0 version, the system kernel is mainly in the SRC folder:

In the previous section on Rtthread, the kernel objects involved in the 10 source files are described in detail:

For kservice.c (for list initialization, forward insertion, backward insertion), memheap.c (Memory heap), MEMPOOL.C (intrinsic pool), moudule.c (moudule.h, application module), SLAB.C (Slab Memory Management algorithm) 5 parts are not described in detail.

Rt-thread Kernel Object Flags flag summary

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.