微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 单片机操作系统RTX51原理分析与移植

单片机操作系统RTX51原理分析与移植

时间:01-07 来源:互联网 点击:

with which the following operations can be executed:

l Wait for a signal

l Send signal

l Clear signal

The task number (see section section "Task Declaration") of the receiver task is used for identifying the signals for the individual operations.

2. Message(via MailBoxes(FIFO))

n By means of the mailbox concept, messages can be exchanged free of conflicts between the individual tasks.

n RTX-51 provides a fixed number of eight mailboxes. Messages can be exchanged in words (2 bytes) via these mailboxes. In this case, a message can represent the actual data to be transferred or the identification of a data buffer(defined by the user). In comparison to the signals, mailboxes are not assigned a fixed task, but can be freely used by all tasks and interrupt functions. These are identified with a mailbox number.

Mailboxes allow the following operations:

l Send a message

l Read a message

Each mailbox is internally consists of three wait lists.(Figure 2)

Figure 2

1. Message list

List of the messages written in the mailbox. These comprise a maximum of eight messages.

2. Write wait list

Wait list for tasks which want to write a message in the message list of the mailbox (maximum 16 tasks).

3. Read wait list

Wait list for tasks which want to read a message from the message list of the mailbox (maximum 16 tasks).

3. Semaphore

n By means of the semaphore concept, resources can be shared free of conflicts between the individual tasks.

n A semaphore contains a token that your code acquires to continue execution. If the resource is already in use, the requesting task is blocked until the token is returned to the semaphore by its current owner.

n There are two types of semaphores: binary semaphores and counting semaphores. As its name implies, a binary semaphore can only take two values: zero or one (token is in or out). A counting semaphore, however, allows values between zero and 65535.

RTX-51 provides a fixed number of eight semaphores of the binary type.

Semaphores allow the following operations:

l Wait for token

l Return (send) token

2. 中断管理

RTX-51 performs task synchronisation for external events by means of the interrupt system.

Two types of interrupt processing are basically supported in this case:

1. 单片机c语言 Interrupt Functions (Interrupt are processed by c51 interrupt funcions)

l Very sudden, periodically occurring interrupts without large coupling with the rest of the system (only infrequent communication with RTX-51 tasks, etc.).

l Very important interrupts which must be served immediately independent of the current system state.

2. Task Interrupts(Interrupt are processed by fast or standard tasks of RTX-51

l Fast Task Interrupts

Important or periodic interrupts which must heavily communicate with the rest of the system when they occur.

l Standard Task Interrupts

Only seldom occurring interrupts which must not be served immediately.

RTX-51 shows considerable different response times for fast and standard tasks.

u The INTERRUPT ENABLE registers of the 8051 are managed by RTX-51 and must not be directly manipulated by the user!

u The Interrupt Priority registers of the 8051 (not to be confused with the softwaretask priorities) are not influenced by RTX-51.

3. 动态内存管理

RTX-51 uses a simple and effective algorithm, which functions with memory blocks of a fixed size. All memory blocks of the same size are managed in a socalled memory pool. A maximum of 16 memory pools each a different block size can be defined. A maximum of 255 memory blocks can be managed in each pool.

n Generate Memory Pool

The application can generate a maximum of 16 memory pools with various

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top