Serial port driving software three-mode redundancy method

The software triple redundancy method solved the serial port anomaly problem caused by single-event upset in space for the domestic spaceborne operating system, achieving highly reliable serial communication and reducing the bit error rate.

CN121387615BActive Publication Date: 2026-04-10KYLIN CORP
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
KYLIN CORP
Filing Date
2025-12-16
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

Domestically developed spaceborne operating systems are susceptible to single-event upsets in space, leading to abnormal serial port drivers. Existing dual-serial-port backup designs lack effective voting mechanisms and cannot meet high reliability requirements.

Method used

A software triple redundancy method is adopted. By modifying the key code path of the serial port driver, a struct Tmr_Common structure and an int tmr_vote_and_repair function are added to realize triple voting, error repair and fault diagnosis. The struct Tmr_Common structure is used to store three copies of data, and the int tmr_vote_and_repair function is used for data comparison and repair.

Benefits of technology

It effectively identifies erroneous data and outputs correct data, significantly reducing the system communication error rate and meeting the high reliability requirements of spaceborne systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121387615B_ABST
    Figure CN121387615B_ABST
Patent Text Reader

Abstract

The application relates to the technical field of operating systems, and particularly provides a software three-module redundancy method for realizing serial port driving, which comprises the following steps: modifying a key code path of serial port driving, adding a struct Tmr_Common structure body and an int tmr_vote_and_repair function; when any key code path is executed, a first piece of data, a second piece of data and a third piece of data are acquired through the struct Tmr_Common structure body, and three-module voting, error repairing and fault diagnosis are realized through the int tmr_vote_and_repair function. Through the above scheme, the influence of a space radiation environment is overcome, the probability of failure of traditional serial port communication after a single event upset in space is reduced, and the high reliability requirement of a satellite-borne system is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The application relates to the technical field of operating systems, and particularly provides a software three-module redundancy method for realizing a serial port driver. BACKGROUND

[0002] With the gradual growth and maturity of domestic operating systems, the domestic operating systems still face many development challenges and bottlenecks while making progress and breakthroughs. In recent years, with the rapid development of space technology at home and abroad, satellite remote sensing technology has developed rapidly. The Starlink project can provide high-speed Internet services for locations where network services are unreliable, expensive or completely unavailable by far exceeding the performance of traditional satellite Internet and being not limited by ground infrastructure. At the same time, satellite Internet projects such as the Thousand Ships constellation have made progress and breakthroughs, and also put forward higher requirements for domestic satellite-borne operating systems. At present, due to the physical phenomenon of single event upset in space, the data stored in the memory may be flipped by a single bit, that is, the single bit may change from 0 to 1 or from 1 to 0, which may cause the serial port driver to be in an abnormal state, and thus the subsequent sent and received data may be incorrect.

[0003] In the existing mainstream satellite overall design, in terms of serial port communication, a single-channel driver design is usually adopted, and the front end receives data to a buffer through an interrupt or DMA, and the rear end performs data analysis. To improve reliability, some systems adopt double-serial-port backup, but lack effective voting mechanisms and heterogeneous fault-tolerant designs, and cannot meet the high reliability requirements of satellite-borne systems. SUMMARY

[0004] In order to overcome the above defects, according to the characteristics of the domestic satellite-borne operating system, the influence of the space radiation environment is overcome, the probability of failure of the traditional serial port communication after encountering single event upset in space is reduced, and the high reliability requirement of the satellite-borne system is realized.

[0005] The application provides a software three-module redundancy method for realizing a serial port driver, comprising the following steps:

[0006] The key code path of the serial port driver is modified, and a struct Tmr_Common structure and an int tmr_vote_and_repair function are added.

[0007] When any key code path is executed, the first data, the second data and the third data are obtained through the struct Tmr_Common structure, and three-module voting, error repair and fault diagnosis are realized through the int tmr_vote_and_repair function.

[0008] Further, the critical code paths include do_sys_open, vfs_open, tty_open, uart_open, pl011_setup, pl011_write functions.

[0009] Further, the struct Tmr_Common structure contains three arrays of the same length, data1, data2 and data3, for storing the first, second and third data respectively.

[0010] Further, the int tmr_vote_and_repair function performs voting and repair according to the comparison result by comparing the three data stored in the struct Tmr_Common structure, and triggers fault diagnosis when the three data are all different.

[0011] Further, the function parameter val is assigned to tmr_common.data1, tmr_common.data2 and tmr_common.data3 respectively through the struct Tmr_Common structure, to obtain the first, second and third data.

[0012] Further, the three-module voting is implemented by the int tmr_vote_and_repair function, including:

[0013] determining whether the first data is the same as the second data, if so, voting to take the first data as the final result;

[0014] if the first data is different from the second data, determining whether the first data is the same as the third data, if so, repairing the second data and voting to take the first data as the final result;

[0015] if the first data is different from the third data, determining whether the second data is the same as the third data, if so, repairing the first data and voting to take the second data as the final result.

[0016] Further, the error repair is implemented by the int tmr_vote_and_repair function, including:

[0017] if the first data is different from the second data, and the first data is the same as the third data, assigning the first data to the second data;

[0018] if the first data is different from the second data, and the first data is also different from the third data, but the second data is the same as the third data, assigning the second data to the first data.

[0019] Further, the fault diagnosis is implemented by the int tmr_vote_and_repair function, and the fault diagnosis includes: if the first data is different from the second data, the first data is also different from the third data, and the second data is also different from the third data, triggering the fault diagnosis.

[0020] Further, the fault diagnosis includes recording a serious error log, reporting fault information through a network interface, and performing a system restart operation.

[0021] Further, the key code path of the serial port driver is modified, and the key code path includes:

[0022] Step a: adding the #include <linux / kernel.h> header file;

[0023] Step b: adding the defined struct Tmr_Common structure in the function;

[0024] Step c: assigning the function parameter val to tmr_common.data1, tmr_common.data2, and tmr_common.data3, respectively;

[0025] Step d: calling the defined tmr_vote_and_repair function to perform three-module voting, error repair, and fault diagnosis.

[0026] The working principle and beneficial effects of the present application are as follows:

[0027] In the implementation of the technical solutions of the present application, when single-bit flipping occurs in the key data of the serial port driver, the error data copy can be effectively identified, and the correct data can be output through the voting mechanism, and the repair of the error data is completed. The error rate of system communication is significantly reduced, and the harsh requirements of the satellite-borne system on high reliability are met. BRIEF DESCRIPTION OF DRAWINGS

[0028] The disclosed content of the present application will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes, and are not intended to limit the protection scope of the present application. In addition, similar numbers in the drawings are used to represent similar components, and wherein:

[0029] Figure 1 is a main step flowchart of a software three-module redundancy method for implementing a serial port driver. DETAILED DESCRIPTION

[0030] Some embodiments of the present application will be described below with reference to the accompanying drawings. Those skilled in the art should understand that these embodiments are only used to explain the technical principles of the present application, and are not intended to limit the protection scope of the present application.

[0031] Embodiment 1

[0032] Figure 1 is a main step flowchart of a software triple modular redundancy method for realizing serial port driving. As shown in Figure 1 , the software triple modular redundancy method for realizing serial port driving mainly includes the following steps S1-S2.

[0033] Step S1: modifying a key code path of serial port driving, adding a struct Tmr_Common structure body and an int tmr_vote_and_repair function, the struct Tmr_Common structure body is used to store triple modular redundancy data, and the int tmr_vote_and_repair function is used to realize triple modular voting, error repair and fault diagnosis.

[0034] In an embodiment, the key code path includes but is not limited to do_sys_open, vfs_open, tty_open, uart_open, pl011_setup, pl011_write functions, and software triple modular code is added in these functions to realize triple modular redundancy. In the functions, the input write value val is assigned to the three arrays at the same time, after triple modular voting and repair, the correct data passed by voting is used to execute the subsequent hardware write operation.

[0035] In an embodiment, the struct Tmr_Common structure body contains three arrays data1, data2 and data3 of the same length, which are respectively used to store the first data, the second data and the third data. The code of the struct Tmr_Common structure body is as follows:

[0036] struct Tmr_Common {

[0037] unsigned char data1

[128] ; / / First data

[0038] unsigned char data2

[128] ; / / Second data

[0039] unsigned char data3

[128] ; / / Third data

[0040] };

[0041] In one embodiment, the int tmr_vote_and_repair(struct Tmr_Common tmr_common) function compares the tmr_common.data1, tmr_common.data2, tmr_common.data3 data stored in the struct Tmr_Common structure; votes and repairs according to the comparison result, and triggers fault diagnosis when the three pieces of data are different. The code of the int tmr_vote_and_repair function is as follows:

[0042] int tmr_vote_and_repair(struct Tmr_Common tmr_common) {

[0043] int ret = 0;

[0044] / / First and second data comparison

[0045] if (memcmp(tmr_common.data1, tmr_common.data2, 128) == 0) {

[0046] printk(KERN_INFO "Data1 and Data2 are the same.\n");

[0047] ret = 1;

[0048] } else {

[0049] / / First and third data comparison

[0050] if (memcmp(tmr_common.data1, tmr_common.data3, 128) == 0) {

[0051] printk(KERN_INFO "Data1 and Data3 are the same.\n");

[0052] / / Repair the second data

[0053] memcpy(tmr_common.data2, tmr_common.data1, 128);

[0054] printk(KERN_INFO "Repair Data2 to be same as Data1.\n");

[0055] ret = 1;

[0056] } else {

[0057] / / Second and third data comparison

[0058] if (memcmp(tmr_common.data2, tmr_common.data3, 128) == 0) {

[0059] printk(KERN_INFO "Data2 and Data3 are the same.\n");

[0060] / / Repair first data

[0061] memcpy(tmr_common.data1, tmr_common.data2, 128);

[0062] printk(KERN_INFO "Repair Data1 to be same as Data2.\n");

[0063] ret = 1;

[0064] } else {

[0065] printk(KERN_ERR "All three data are different! Trigger faultdiagnosis.\n");

[0066] ret = 0;

[0067] }

[0068] }

[0069] }

[0070] return ret;

[0071] }

[0072] Step S2: When any critical code path is executed, the first, second, and third data are obtained through the struct Tmr_Common structure, and the triple module voting, error repair, and fault diagnosis are implemented through the int tmr_vote_and_repair function.

[0073] In one embodiment, the implementation of the first data, the second data and the third data through the struct Tmr_Common structure is that the function parameter val is assigned to tmr_common.data1, tmr_common.data2 and tmr_common.data3 respectively through the struct Tmr_Common structure, so as to obtain the first data, the second data and the third data.

[0074] In one embodiment, the int tmr_vote_and_repair function can be used to determine the voting result, if there are two same data copies, the same data is adopted as the correct data, and the inconsistent data copies are repaired; if the three data copies are not the same, the fault diagnosis process is triggered.

[0075] The implementation of the three-mode voting through the int tmr_vote_and_repair function is as follows:

[0076] First, it is determined whether the first data and the second data are the same:

[0077] If the same, the final voting takes the first data;

[0078] If the first data and the second data are different, it is determined whether the first data and the third data are the same, if the same, it means that the second data is problematic, the second data is repaired, and the final voting takes the first data; if the first data and the third data are different, it is determined whether the second data and the third data are the same, if the same, the data repair module is called to repair the first data, and the final voting takes the second data.

[0079] The "repairing the second data" is to copy the content of the first data into the second data; the "repairing the first data" is to copy the content of the second data into the first data.

[0080] The implementation of the error repair through the int tmr_vote_and_repair function is as follows: if the first data and the second data are different, and the first data and the third data are the same, it means that the second data is problematic, at this time, the first data is assigned to the second data; if the first data and the second data are different, the first data and the third data are also different, but the second data and the third data are the same, it means that the first data is problematic, at this time, the second data is assigned to the first data.

[0081] The manner of implementing fault diagnosis through the int tmr_vote_and_repair function is that, if the first data is different from the second data, the first data is also different from the third data, and the second data is also different from the third data, it is indicated that the three pieces of data are all incorrect, fault diagnosis is triggered, a serious error log is recorded, fault information is reported through a network interface, and a system restart operation is performed.

[0082] Based on the above steps S1-S2, when single-bit flipping occurs in the serial port driving key data, the incorrect data copy can be effectively identified, and correct data can be output through a voting mechanism, and the repair of incorrect data is completed. The error rate of system communication is significantly reduced, and the stringent requirements of the on-board system on high reliability are met.

[0083] On the domestic D2000V processor, the Galaxy Kirin embedded operating system (space version) V10 version is installed. At present, due to the physical phenomenon of single event upset in space, the data stored in the memory may be flipped by single bit, that is, the single bit may change from 0 to 1 or from 1 to 0. In this case, the serial port driver as a whole will be in an abnormal state, thereby causing the subsequent sent and received data to be incorrect. After implementing the scheme of the patent, the key code path of the serial port driver is set to software triple mode, the influence of the space radiation environment is overcome, the probability of failure of the traditional serial port communication after encountering single event upset in space is reduced, and the requirement of high reliability of the on-board system is met.

[0084] Embodiment 2

[0085] On the basis of embodiment 1, taking the pl011_write function as an example, the modification of the specific implementation of the key code path of the serial port driver includes the following steps a-d.

[0086] Step a: add the #include <linux / kernel.h> header file;

[0087] Step b: add the defined struct Tmr_Common structure in the function;

[0088] Step c: assign the function parameter val to tmr_common.data1, tmr_common.data2, and tmr_common.data3, respectively;

[0089] Step d: call the defined tmr_vote_and_repair(tmr_common) function to perform triple voting, error repair, and fault diagnosis.

[0090] In one embodiment, the pl011_write function before modification is as follows:

[0091] static void pl011_write(unsigned int val, const struct uart_amba_port uap, unsigned int reg) {

[0092] void__iomem addr=uap->port.membase+pl011_reg_to_offset(uap, reg);

[0093] if (uap->port.iotype == UPIO_MEM32)

[0094] writel_relaxed(val, addr);

[0095] else

[0096] writew_relaxed(val, addr);

[0097] }

[0098] The modified pl011_write function is:

[0099] #include <linux / kernel.h>

[0100] static void pl011_write(unsigned int val, const struct uart_amba_port uap, unsigned int reg) {

[0101] void__iomem addr=uap->port.membase+pl011_reg_to_offset(uap, reg);

[0102] struct Tmr_Common tmr_common;

[0103] tmr_common.data1 = val;

[0104] tmr_common.data2 = val;

[0105] tmr_common.data3 = val;

[0106] tmr_vote_and_repair(tmr_common);

[0107] if (uap->port.iotype == UPIO_MEM32)

[0108] writel_relaxed(tmr_common.data1, addr);

[0109] else

[0110] writew_relaxed(tmr_common.data1, addr);

[0111] It should be noted that, although the steps in the above embodiments are described in a specific order, it is understood by those skilled in the art that, in order to achieve the effect of the present application, the steps do not necessarily have to be executed in such an order, and they can be executed simultaneously (in parallel) or in other orders, and these changes are within the protection scope of the present application.

[0112] So far, the technical solutions of the present application have been described in combination with the preferred embodiments shown in the drawings, but it is easily understood by those skilled in the art that the protection scope of the present application is obviously not limited to these specific embodiments. Those skilled in the art can make equivalent changes or replacements to the related technical features without deviating from the principles of the present application, and the technical solutions after these changes or replacements will all fall within the protection scope of the present application.

Claims

1. A software triple modular redundancy method for implementing serial port driving, characterized in that, The method comprises the following steps: modify the key code path of the serial port driver, add a struct Tmr_Common structure and an int tmr_vote_and_repair function; when any key code path is executed, obtain first data, second data and third data through the struct Tmr_Common structure, and implement three-module voting, error repair and fault diagnosis through the int tmr_vote_and_repair function; implementing three-module voting through the int tmr_vote_and_repair function comprises: judging whether the first data and the second data are identical, if yes, voting the final result to take the first data; if the first data and the second data are different, judging whether the first data and the third data are identical, if yes, repairing the second data, and voting the final result to take the first data; if the first data and the third data are different, judging whether the second data and the third data are identical, if yes, repairing the first data, and voting the final result to take the second data.

2. The software triple modular redundancy method for implementing serial port driver according to claim 1, characterized in that: the key code path comprises do_sys_open, vfs_open, tty_open, uart_open, pl011_setup and pl011_write functions.

3. The software triple modular redundancy method for implementing serial port driver according to claim 1, characterized in that: the struct Tmr_Common structure comprises three arrays data1, data2 and data3 of the same length, which are used for storing the first data, the second data and the third data respectively.

4. The software triple modular redundancy method for implementing serial port driver according to claim 1, wherein: the int tmr_vote_and_repair function compares the three pieces of data stored in the struct Tmr_Common structure, votes and repairs according to the comparison result, and triggers fault diagnosis when the three pieces of data are different.

5. The software triple modular redundancy method for implementing serial port driver according to claim 1, wherein: the first data, the second data and the third data are obtained by assigning the function parameter val to tmr_common.data1, tmr_common.data2 and tmr_common.data3 respectively through the struct Tmr_Common structure.

6. The software triple modular redundancy method for implementing serial port driver according to claim 1, wherein, implementing error repair through the int tmr_vote_and_repair function comprises: if the first data and the second data are different, and the first data and the third data are identical, assigning the first data to the second data; if the first data and the second data are different, and the first data and the third data are also different, but the second data and the third data are identical, assigning the second data to the first data.

7. The software triple modular redundancy method for implementing serial port driver according to claim 1, wherein, implementing fault diagnosis through the int tmr_vote_and_repair function comprises:

8. The software triple modular redundancy method of claim 7, wherein, if the first data and the second data are different, the first data and the third data are also different, and the second data and the third data are also different, triggering fault diagnosis.

9. The software triple modular redundancy method for implementing serial port driver according to claim 1, wherein, triggering fault diagnosis comprises recording a serious error log, reporting fault information through a network interface, and performing a system restart operation. modifying the key code path of the serial port driver comprises: Step a: Add the #include <linux / kernel.h> header file; Step b: Add the defined struct Tmr_Common structure inside the function; Step c: Assign the function parameters val to tmr_common.data1, tmr_common.data2, and tmr_common.data3, respectively; Step d: Call the defined tmr_vote_and_repair function for three-module voting, error repair, and fault diagnosis.