Synchronous blocking state machine based on real-time operating system for railway communication equipment
By adopting the structural design of the hardware layer, drive layer, scheduling layer and functional layer in railway communication equipment, combined with the synchronous blocking state machine model, the problems of high difficulty and poor portability of software structures in embedded systems are solved, and efficient development and stable operation are achieved.
Patent Information
- Application Number
- CN201811498572.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-12-08
- Publication Date
- 2025-09-02
- Estimated Expiration
- 2038-12-08
AI Technical Summary
In embedded systems, existing railway communication equipment has problems such as high difficulty in software structure stratification, poor transplantability, low development efficiency and insufficient stability.
The structural design of the hardware layer, the driver layer, the scheduling layer and the functional layer is used to respond to hardware interrupts, data processing, functional module division and system status representation, and interact with operating system threads, and a synchronous blocking state machine model is used to improve independence and stability.
It improves the development efficiency and stability of railway communication equipment, is suitable for the transplantation of different embedded platforms, reduces programming difficulty and limits the scope of influence between modules.
Smart Images

Figure CN111290346B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of railway communication equipment design and software system structure, in particular to a synchronous blocking state machine based on a real-time operating system for railway communication equipment. Background Art
[0002] With the rapid development of rail transit, the application of communication technology in railway operations is increasing. Railway communication equipment typically has high concurrency and real-time requirements. While maintaining communication protocols with corresponding equipment, it also needs to collect data and respond to user interactions. However, to ensure stable operation, railway communication equipment generally uses embedded systems equipped with real-time operating systems. Embedded systems typically have limited memory, are programmed using low-level languages, and may even directly operate on hardware registers. Compared to standard PCs and industrial control computers, their hardware-related portability is poor, and software layering is more difficult. Existing traditional software design structures and methods are difficult to directly apply to these embedded systems. Summary of the Invention
[0003] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a synchronous blocking state machine based on a real-time operating system for railway communication equipment.
[0004] The purpose of the present invention can be achieved by the following technical solutions:
[0005] A synchronous blocking state machine based on a real-time operating system for railway communication equipment comprises a hardware layer, a driver layer, a scheduling layer and a function layer, wherein the hardware layer, the driver layer, the scheduling layer and the function layer are connected in sequence;
[0006] The hardware layer is used to respond to hardware interrupts of devices and collect data;
[0007] The driver layer creates a driver thread to process the data and collected information, and converts the data into the content required by the scheduling layer;
[0008] The scheduling layer is used to divide the equipment requirements into functional modules, and each functional module establishes a scheduling thread;
[0009] The functional layer creates functional threads to represent the current system status.
[0010] Preferably, the hardware layer adopts the hardware interrupt of the embedded system, which has the highest real-time performance.
[0011] Preferably, the hardware layer only performs basic conversion on data and information, does not perform business-level processing on the data, and transfers the original data to the driver layer.
[0012] Preferably, the driving layer performs packet assembly, verification, and error correction operations on the received single-byte information according to the communication protocol, and transfers the received data to the scheduling layer.
[0013] Preferably, the scheduling layer adopts an event-driven model, and the events come from the logic drive of the function layer or the data drive of the driver layer.
[0014] Preferably, if the functional layer logic has multiple states or has delay and thread synchronization requirements, the scheduling layer establishes a functional thread and completes the logic control in the functional thread. During the logic control process, if there is a conditional jump, the functional thread will be blocked until the jump condition is met to enter the next state.
[0015] Preferably, the scheduling layer is also provided with a central scheduling thread for unified management of each functional module and possible overall synchronization requirements. If each functional module of the device is relatively independent, a central scheduling thread may not be designed.
[0016] Preferably, the driver layer, scheduling layer, and function layer are all based on operating system threads, so each layer interacts using operating system thread communication methods, such as semaphores, mailboxes, events, message queues, etc.
[0017] Compared with the prior art, the present invention has the following advantages:
[0018] 1. The present invention utilizes separate operating system threads both horizontally (for functional requirements) and vertically (for system structure hierarchical division), resulting in high independence and low coupling. This makes it suitable for module splitting, facilitating secondary development and the development of similar devices. It is also suitable for porting to different embedded platforms, significantly improving development efficiency. Furthermore, if errors occur in some modules during operation, the impact on other modules is limited, improving operational stability.
[0019] 2. This invention utilizes a novel synchronous blocking architecture at the functional and scheduling layers. The current system state is represented by the location of the functional thread, eliminating the need for programmers to manually manage flags. This approach to sequential thinking during program execution further simplifies programming and modification of complex logic devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a schematic diagram of the structure of the synchronous blocking state machine;
[0021] Figure 2 It is the software flow chart of hardware layer;
[0022] Figure 3 This is the driver layer software flow chart;
[0023] Figure 4This is the software flow chart of the scheduling layer and functional layer. DETAILED DESCRIPTION
[0024] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of them. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.
[0025] Figure 1 This paper shows the software structure of a railway communication device after adopting the synchronous blocking state machine described in this invention. Based on the relevant characteristics of this aspect, the software structure is divided into hardware layer, driver layer, scheduling layer, and function layer. Then, according to the content of this aspect, the design is carried out layer by layer.
[0026] In this example, the embedded device needs to call four types of interrupt devices and one type of polling device. The hardware layer interrupt service function can be based on Figure 2 The design is based on the flowchart shown. Because hardware interrupts have a higher priority than any operating system thread, the present invention is based on a real-time operating system (RTOS) software architecture and is not suitable for performing excessive operations within an interrupt, as this would disrupt the real-time nature of the operating system. Therefore, only one semaphore is released to the driver layer within the interrupt service function.
[0027] Figure 3 The following diagram shows a typical driver-layer thread flow. The thread begins by initializing the hardware and then waits for a semaphore signal from the interrupt service routine. After receiving the semaphore, it performs read and write operations on the corresponding hardware, assembling, verifying, and correcting errors based on the received data. Finally, it passes the assembled data packet to the scheduling layer for use.
[0028] Figure 4 This example shows synchronous blocking between the scheduling layer and the function layer. The right side of the image shows the scheduling thread, while the left side shows a function thread that the scheduling thread starts after receiving information from the driver layer. This function thread first executes function logic 1. Then, during a delay, it calls the operating system's thread sleep function, which prevents it from participating in scheduling for a period of time, thus achieving a functional delay. After the delay, it executes function logic 2 and is then locked by the system synchronization lock, awaiting an unlock signal from the scheduling thread before continuing. Upon receiving the unlock signal from the scheduling thread, the function thread continues executing function logic 3.
[0029] It can be seen that the present invention has a certain degree of independence at different levels, and the functional logic program writing process is consistent with human thinking. This example embodies the advantages and innovations of the present invention.
[0030] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in the present invention, and such modifications or substitutions are intended to be within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be subject to the scope of protection of the claims.
Claims
1. A synchronous blocking state machine based on a real-time operating system for railway communication equipment, characterized in that: It includes a hardware layer, a driver layer, a scheduling layer and a function layer, wherein the hardware layer, the driver layer, the scheduling layer and the function layer are connected in sequence; The hardware layer is used to respond to hardware interrupts of devices and collect data; The driver layer creates a driver thread to process the data and collected information, and converts the data into the content required by the scheduling layer; The scheduling layer is used to divide the equipment requirements into functional modules, and each functional module establishes a scheduling thread; The functional layer creates functional threads to represent the current system status; The scheduling layer adopts an event-driven model, where events originate from the logic drive of the functional layer or the data drive of the driver layer. If the functional layer logic has multiple states or has delay or thread synchronization requirements, the scheduling layer establishes a functional thread and completes the logic control in the functional thread. During the logic control process, if there is a conditional jump, the functional thread is blocked until the jump condition is met and the next state is entered. The scheduling layer is also equipped with a central scheduling thread for unified management of various functional modules and possible overall synchronization requirements. The hardware layer only performs basic conversion on data and information, does not process the data at the business level, and transfers the original data to the driver layer; A new synchronous blocking structure is adopted in the functional layer and scheduling layer, and the current system status is represented by the location where the functional thread runs.
2. A synchronous blocking state machine based on a real-time operating system for railway communication equipment according to claim 1, characterized in that: The hardware layer adopts the hardware interrupt of the embedded system.
3. The synchronous blocking state machine based on a real-time operating system for railway communication equipment according to claim 1, characterized in that: The driving layer performs packet assembly, verification, and error correction operations on the received single-byte information according to the communication protocol, and transfers the received data to the scheduling layer.
4. A synchronous blocking state machine based on a real-time operating system for railway communication equipment according to claim 1, characterized in that: The driver layer, scheduling layer and function layer are all based on operating system threads, so each layer interacts using the communication method between operating system threads.
Citation Information
Patent Citations
Method and device for sending communication information
CN103237127A
Driver layer based serial communication processing method
CN105068947A
Inertial device graphical test system based on VxWorks
CN108710552A
Synchronous blocking state machine for railway communication equipment
CN209460633U