Dual-system delay time determination method, device and terminal equipment
By acquiring and calculating the multiple timestamp differences in data transmitted in the dual system, the delay strategy of the dual system is determined, which solves the problem of delay time error caused by one-way transmission and improves the accuracy of the delay time.
Patent Information
- Application Number
- CN202211013490.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-23
- Publication Date
- 2025-04-25
- Estimated Expiration
- 2042-08-23
AI Technical Summary
There is an error in the dual-system delay time determined by one-way transmission in the prior art, resulting in a decrease in the accuracy of the delay time.
By obtaining the time stamp of the transmitted data in the dual system, including the first time stamp and the second time stamp of the data packet transmitted from the first system to the second system, and the third time stamp and the fourth time stamp of the reply packet transmitted from the second system to the first system, the difference of each time stamp is calculated, and the delay strategy of the dual system is determined based on the relationship between the difference value and the preset condition to obtain the delay time.
It effectively avoids the problem of errors in determining delay time with one-way transmission, and improves the accuracy of delay time.
Smart Images

Figure CN115361083B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data transmission, and in particular to a method, device and terminal equipment for determining a delay time of a dual system. Background Art
[0002] In order to reduce the power consumption of the terminal device, a dual system mode is adopted, in which the first system is responsible for processing the internal operation of the terminal device, and the second system is responsible for processing the data input of the external device of the terminal device. If the terminal device is disconnected from the external device, the second system is in a dormant state to reduce power consumption. If the terminal device is connected to the external device, the first system can be used to wake up the second system to work. Regardless of the working status of the dual systems, the data of the dual systems remain synchronized.
[0003] In existing terminal devices, when the first system transmits data to the second system, in order to maintain time synchronization between the two systems, the delay time is determined by the sending timestamp and receiving timestamp of the data packet transmitted from the first system to the second system. The delay time is only determined by one-way transmission. If the first system is delayed due to its own delay, the delay time is determined based on the delayed first system, which has accidental factors and cannot guarantee authenticity. If the one-way transmission protocol is delayed during the transmission process between the two systems, the system receiving the data packet in the second system will increase the delay time in the process of receiving the data packet, and the corresponding delay time of the two systems will increase, resulting in a decrease in the accuracy of the delay time.
[0004] Therefore, how to improve the accuracy of the delay time of the dual systems is an urgent problem to be solved by those skilled in the art. Summary of the invention
[0005] The purpose of the present invention is to provide a method, device and terminal equipment for determining the delay time of a dual system, which effectively avoids the problem of error in the existing delay time determined by one-way transmission and improves the accuracy of the delay time.
[0006] In order to solve the above technical problems, the present invention provides a method for determining a delay time of a dual system, which is applied to a terminal device and comprises:
[0007] Acquire timestamps of transmission data in the dual systems, wherein the timestamps include at least a set of first timestamps and second timestamps for transmitting a data packet from the first system to the second system, and a set of third timestamps and fourth timestamps for transmitting a response data packet from the second system to the first system;
[0008] Determine the difference between each time stamp according to the corresponding relationship between each time stamp of each group;
[0009] When the timestamp differences satisfy the preset conditions, the delay strategy of the dual systems is determined according to the relationship between the timestamp differences and the preset conditions to obtain the delay time.
[0010] Preferably, the process of establishing the first timestamp and the second timestamp of transmitting a data packet from the first system to the second system comprises the following steps:
[0011] Obtain a data packet of the first system, and record the sending time of the data packet as a first timestamp;
[0012] Controlling the first system to send a data packet to the second system;
[0013] Controlling the second system to record the time when the data packet is received as a second timestamp;
[0014] Correspondingly, the process of establishing the third timestamp and the fourth timestamp of transmitting the response data packet from the second system to the first system includes the following steps:
[0015] Control the second system to generate a response frame of the reply data packet according to the data packet, record the sending time of the response frame as the third timestamp, and send the response frame, the second timestamp and the third timestamp to the first system;
[0016] The first system is controlled to record the reception completion time of the response frame, the second timestamp and the third timestamp as a fourth timestamp.
[0017] Preferably, determining the timestamp differences according to the corresponding relationship between the timestamps of the groups includes:
[0018] Subtracting the first timestamp from the second timestamp to obtain a first difference value;
[0019] The third timestamp is subtracted from the fourth timestamp to obtain a second difference value.
[0020] Preferably, the preset condition is that the first difference is different from the second difference, and according to the relationship between each timestamp difference and the preset condition, the delay strategy of the dual system is determined to obtain the delay time, including:
[0021] Determine whether the first difference is the same as the second difference;
[0022] If they are different, the delay state of the dual systems is determined to be transmission delay;
[0023] Subtracting the first timestamp from the fourth timestamp to obtain a third difference value;
[0024] Subtracting the second timestamp from the third timestamp to obtain a fourth difference value;
[0025] Subtracting the third difference from the fourth difference to obtain a first two-way delay time of the dual system;
[0026] Dividing the first two-way delay time by 2 to determine the first one-way delay time of the dual system;
[0027] The first one-way delay time is used as the delay time of the dual systems.
[0028] Preferably, the timestamp further includes a set of fifth timestamp and sixth timestamp for transmitting the data packet from the first system to the second system, the preset condition is that the first difference is different from the fifth difference, wherein the fifth timestamp is different from the first timestamp, and the fifth difference is obtained by subtracting the fifth timestamp from the sixth timestamp, and according to the relationship between each timestamp difference and the preset condition, determining the delay strategy of the dual systems to obtain the delay time includes:
[0029] Determine whether the first difference value is the same as the fifth difference value;
[0030] If they are different, the delay state of the dual systems is determined to be a sending delay;
[0031] The first difference, the second difference and the fifth difference are averaged to obtain the delay time of the dual systems.
[0032] Preferably, the timestamp includes two groups of first timestamps and second timestamps corresponding to the transmission of data packets from the first system to the second system, and two groups of third timestamps and fourth timestamps corresponding to the transmission of response data packets from the second system to the first system. The preset condition is that the first difference of one group is different from the second difference, and is different from the first difference of the other group. According to the relationship between each timestamp difference and the preset condition, the delay strategy of the dual systems is determined to obtain the delay time, including:
[0033] Determine whether the first difference value of one of the groups is the same as the corresponding second difference value;
[0034] If the first difference value of one of the groups is different from the corresponding second difference value, determining whether the first difference value of one of the groups is the same as the first difference value of the other group;
[0035] If the first difference value of one group is different from the first difference value of the other group, determining the delay state of the dual systems as a transmission delay and a sending delay;
[0036] Subtract the first timestamp and the fourth timestamp corresponding to the two groups from each other to obtain a third difference value;
[0037] Subtract the second timestamp and the third timestamp corresponding to the two groups from each other to obtain a fourth difference value;
[0038] Subtracting the third difference value and the fourth difference value corresponding to each group to obtain the first two-way delay time of the dual system and determine the first one-way delay time of the dual system;
[0039] The first one-way delay time of each group is averaged to obtain the delay time of the dual system.
[0040] Preferably, the transmission protocol for transmitting the data packet from the first system to the second system is the same as the transmission protocol for transmitting the response data packet from the second system to the first system, and the transmission protocol is the SPI communication protocol or the I2C communication protocol.
[0041] Preferably, after determining the delay time, the method further includes:
[0042] Send the delay time to the kernel of the terminal device;
[0043] Controls the input subsystem to send the delay time at the kernel to the display device of the terminal device for display.
[0044] In order to solve the above technical problems, the present invention further provides a device for determining the delay time of a dual system, comprising:
[0045] An acquisition device, used for acquiring timestamps of transmission data in the dual systems, wherein the timestamps include at least a set of first timestamps and second timestamps for transmitting a data packet from the first system to the second system, and a set of third timestamps and fourth timestamps for transmitting a response data packet from the second system to the first system;
[0046] A first determination module, configured to determine the difference between each time stamp according to the corresponding relationship between each time stamp of each group;
[0047] The second determination module is used to determine the delay strategy of the dual systems to obtain the delay time according to the relationship between each time stamp difference and the preset condition when each time stamp difference meets the preset condition.
[0048] In order to solve the above technical problems, the present invention further provides a terminal device, comprising:
[0049] Memory for storing computer programs;
[0050] A processor is used to implement the steps of the method for determining the delay time of the dual systems as described above when executing a computer program.
[0051] The present invention provides a dual-system delay time determination method, which is applied to terminal equipment and includes: obtaining the timestamp of the transmission data in the dual system, wherein the timestamp includes at least a group of first and second timestamps for transmitting a data packet from the first system to the second system, and a group of third and fourth timestamps for transmitting a response data packet from the second system to the first system; determining the differences of each timestamp according to the corresponding relationship between each timestamp of each group; when each timestamp difference meets the preset condition, the delay strategy of the dual system is determined according to the relationship between each timestamp difference and the preset condition to obtain the delay time. The method realizes bidirectional transmission by obtaining the timestamp of transmitting a data packet from the first system to the second system and the timestamp record of transmitting a response data packet from the second system to the first system, and determining each timestamp difference according to the corresponding relationship between the first timestamp, the second timestamp, the third timestamp and the fourth timestamp; when each of the timestamp differences meets the preset condition, the delay strategy is determined according to the relationship between the timestamp difference and the preset condition to obtain the delay time. The method effectively avoids the problem of error in the existing delay time determined by unidirectional transmission and improves the accuracy of the delay time.
[0052] In addition, the present invention also provides a dual-system delay time determination device and terminal equipment, which have the same beneficial effects as the dual-system delay time determination method described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0054] Figure 1 A flowchart of a method for determining a delay time of a dual system provided by an embodiment of the present invention;
[0055] Figure 2 A schematic diagram of two groups of time stamps for transmitting data in a dual system provided by an embodiment of the present invention;
[0056] Figure 3 A structural diagram of a dual-system delay time determination device provided by an embodiment of the present invention;
[0057] Figure 4 A structural diagram of a terminal device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0059] The core of the present invention is to provide a method, device and terminal equipment for determining the delay time of a dual system, which effectively avoids the problem of error in the existing delay time determined by one-way transmission and improves the accuracy of the delay time.
[0060] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0061] It should be noted that the method for determining the delay time of the dual system provided by the present invention is applicable to terminal devices of the dual system, and the terminal devices can be wearable devices (earphones, smart bracelets, smart watches, augmented reality devices (Augmented Reality, AR) or virtual reality (Virtual Reality, VR), etc.), or smart phones, laptops, etc., without specific limitations here, and the device type of the terminal device can be set according to actual conditions.
[0062] Figure 1 A flow chart of a method for determining a delay time of a dual system provided by an embodiment of the present invention, such as Figure 1 As shown, applied to a terminal device, the method includes:
[0063] S11: Acquire timestamps of transmission data in the dual systems, wherein the timestamps include at least a set of first timestamps and second timestamps for transmitting a data packet from the first system to the second system, and a set of third timestamps and fourth timestamps for transmitting a response data packet from the second system to the first system;
[0064] S12: Determine the difference between the timestamps according to the corresponding relationship between the timestamps of the groups;
[0065] S13: When the timestamp differences meet the preset conditions, the delay strategy of the dual systems is determined according to the relationship between the timestamp differences and the preset conditions to obtain the delay time.
[0066] Specifically, the timestamp of the transmission data in the dual system is obtained, and the transmission data in the dual system can be data such as transmission data packets, transmission message information or transmission frames, and the dual system includes a first system and a second system. Compared with the prior art, the timestamp includes two transmission directions, one transmission direction is the first timestamp and the second timestamp of the data packet transmitted from the first system to the second system, and the other transmission direction is opposite to the above transmission direction, specifically the third timestamp and the fourth timestamp of the response data packet transmitted from the second system to the first system, wherein the response data packet generates a corresponding response frame.
[0067] The present invention does not specifically limit which system in the dual system sends a data packet or which system sends a response frame. Regardless of which system, its last timestamp is a timestamp record of two transmission directions. Its response frame is a response frame generated by the system receiving the data packet in the current group after receiving the data packet, so that the first system sending the data packet can know that the data packet has been successfully sent to the second system.
[0068] It should be noted that, in order to completely record the entire data packet sending process, the second system uses the moment when the entire data packet is received as the second timestamp. Specifically, the process of establishing the first timestamp and the second timestamp of the data packet transmitted from the first system to the second system includes the following steps:
[0069] Obtain a data packet of the first system, and record the sending time of the data packet as a first timestamp;
[0070] Controlling the first system to send a data packet to the second system;
[0071] Controlling the second system to record the time when the data packet is received as a second timestamp;
[0072] Correspondingly, the process of establishing the third timestamp and the fourth timestamp of transmitting the response data packet from the second system to the first system includes the following steps:
[0073] Control the second system to generate a response frame of the reply data packet according to the data packet, record the sending time of the response frame as the third timestamp, and send the response frame, the second timestamp and the third timestamp to the first system;
[0074] The first system is controlled to record the reception completion time of the response frame, the second timestamp and the third timestamp as a fourth timestamp.
[0075] Figure 2 A schematic diagram of two sets of time stamps for transmitting data in a dual system according to an embodiment of the present invention is shown in FIG. Figure 2As shown, the dual systems of the terminal device 1 are two systems, A and B. A data packet is sent from system A to system B. The data packet is sent at the first timestamp, and the moment when system B finishes receiving the data packet is the second timestamp. System B generates a corresponding response frame based on the received data packet and sends it to system A. Since systems A and B only know the timestamps of receiving and sending in their local systems, in system B, the second timestamp and the next timestamp (the moment of sending the response frame) are sent together with the response frame to system A, so that system A knows that system B has successfully received the data packet. The moment when system A finishes receiving the response frame is the fourth timestamp.
[0076] In step S12, the timestamp differences are determined according to the corresponding relationship between the timestamps in the groups, that is, the four timestamps in the two current groups can each obtain a corresponding timestamp difference.
[0077] When the timestamp differences meet the preset conditions, the delay strategy of the dual system is determined according to the relationship between the timestamp differences and the preset conditions. Specifically, the delay strategy sets different strategies for different preset conditions to obtain the corresponding delay time. Delay refers to the time required for a message or packet to be transmitted from one end of a network to the other end. The same is true for dual systems. Delay includes sending delay, transmission delay, processing delay and queuing delay. Generally, sending delay and transmission delay are the main considerations. For large message lengths, sending delay is the main contradiction. For small message lengths, propagation delay is the main contradiction.
[0078] The transmission delay may be caused by the delay in the initialization process of the first system responsible for sending the data packet, which causes a delay at the time (second timestamp) after the second system receives the data packet. The transmission delay is based on the delay in the one-way transmission protocol process. For example, there is a delay in the one-way transmission from system A to system B, but there is no delay in the one-way transmission from system B to system A.
[0079] Based on the different delays mentioned above, the delay time strategy determined is also different, so it is necessary to check which preset conditions are met by the timestamp differences.
[0080] The present invention provides a dual-system delay time determination method, which is applied to terminal equipment and includes: obtaining the timestamp of the transmission data in the dual system, wherein the timestamp includes at least a group of first and second timestamps for transmitting a data packet from the first system to the second system, and a group of third and fourth timestamps for transmitting a response data packet from the second system to the first system; determining the differences of each timestamp according to the corresponding relationship between each timestamp of each group; when each timestamp difference meets the preset condition, the delay strategy of the dual system is determined according to the relationship between each timestamp difference and the preset condition to obtain the delay time. The method realizes bidirectional transmission by obtaining the timestamp of transmitting a data packet from the first system to the second system and the timestamp record of transmitting a response data packet from the second system to the first system, and determining each timestamp difference according to the corresponding relationship between the first timestamp, the second timestamp, the third timestamp and the fourth timestamp; when each of the timestamp differences meets the preset condition, the delay strategy is determined according to the relationship between the timestamp difference and the preset condition to obtain the delay time. The method effectively avoids the problem of error in the existing delay time determined by unidirectional transmission and improves the accuracy of the delay time.
[0081] Based on the above embodiment, determining the timestamp differences according to the corresponding relationship between the timestamps of the groups in step S12 includes:
[0082] Subtracting the first timestamp from the second timestamp to obtain a first difference value;
[0083] The third timestamp is subtracted from the fourth timestamp to obtain a second difference value.
[0084] To facilitate subsequent calculations, the timestamp difference is based on the local system of each unilateral system. The local system only knows its own timestamp information. Therefore, on this basis, from the perspective of the central processing unit (CPU) of the terminal device, the first timestamp of the first system is subtracted from the second timestamp of the second system to obtain the first difference, and the third timestamp of the second system is subtracted from the fourth timestamp of the first system to obtain the second difference.
[0085] The embodiment of the present invention provides that the first time stamp is subtracted from the second time stamp to obtain the first difference value; and the third time stamp is subtracted from the fourth time stamp to obtain the second difference value, which is convenient for satisfying the subsequent preset conditions and determining the delay time.
[0086] On the basis of the above embodiment, the preset condition is that the first difference is different from the second difference, and the delay strategy of the dual systems is determined according to the relationship between each timestamp difference and the preset condition to obtain the delay time in step S13, including:
[0087] Determine whether the first difference is the same as the second difference;
[0088] If they are different, the delay state of the dual systems is determined to be transmission delay;
[0089] Subtracting the first timestamp from the fourth timestamp to obtain a third difference value;
[0090] Subtracting the second timestamp from the third timestamp to obtain a fourth difference value;
[0091] Subtracting the third difference from the fourth difference to obtain a first two-way delay time of the dual system;
[0092] Dividing the first two-way delay time by 2 to determine the first one-way delay time of the dual system;
[0093] The first one-way delay time is used as the delay time of the dual systems.
[0094] Specifically, determine whether the first difference is the same as the second difference. If they are the same, it is determined that the transmission protocol between the first system and the second system is delayed, so the delay state of the dual system is the transmission delay. Its delay strategy is the delay time strategy of the transmission delay. Based on the local systems of each system, for the first system, the first timestamp t1 is subtracted from the fourth timestamp t4 to obtain the third difference; for the second system, the second timestamp t2 is subtracted from the third timestamp t3 to obtain the fourth difference. Then the third difference is subtracted from the fourth difference to obtain the first two-way delay time (t4-t1)-(t3-t2). Determine the one-way delay time again, and divide it by 2, that is: [(t4-t1)-(t3-t2)] / 2 to obtain the delay time of the dual system.
[0095] The four time stamps of bidirectional transmission provided by the embodiment of the present invention effectively avoid the problem of error in the existing delay time determined by unidirectional transmission, and improve the accuracy of the delay time.
[0096] On the basis of the above embodiment, the timestamp further includes a set of fifth timestamp and sixth timestamp for transmitting the data packet from the first system to the second system, the preset condition is that the first difference is different from the fifth difference, wherein the fifth timestamp is different from the first timestamp, and the fifth difference is obtained by subtracting the fifth timestamp from the sixth timestamp, and according to the relationship between each timestamp difference and the preset condition, the delay strategy of the dual systems is determined to obtain the delay time, including:
[0097] Determine whether the first difference value is the same as the fifth difference value;
[0098] If they are different, the delay state of the dual systems is determined to be a sending delay;
[0099] The first difference, the second difference and the fifth difference are averaged to obtain the delay time of the dual systems.
[0100] Specifically, the timestamps include two groups of timestamps for transmitting data packets from the first system to the second system, and one group of timestamps for transmitting reply data packets (response frames) from the second system to the first system. It should be noted that the response frames transmitted from the second system to the first system can be for any of the two groups of data packets transmitted from the first system to the second system, without specific limitation, as long as two groups of bidirectional transmission timestamps are ensured to exist in the timestamps of the two systems.
[0101] The fifth timestamp and the sixth timestamp are the time when the first system starts sending the data packet as the fifth timestamp, and the time when the second system finishes receiving the data packet as the sixth timestamp. The data packet here can be the same as the information of the data packet between the first timestamp and the second timestamp in the above embodiment, or it can be different. In this embodiment, the data type is only limited to the data packet, which is distinguished from the message information of the response frame.
[0102] It is determined whether the first difference and the fifth difference are the same. If they are different, it means that the sending time of the two groups of data packets sent from the first to the second is different, and a sending delay occurs. The delay time is determined according to the delay strategy determined by the sending delay, that is, the delay time is obtained by processing the average of the three differences (the first difference, the second difference and the fifth difference), that is, [(t2-t1)+(t4-t3)+(t6-t5)] / 3.
[0103] The six time stamps of bidirectional transmission provided by the embodiment of the present invention effectively avoid the problem of error in the existing delay time determined by unidirectional transmission, and improve the accuracy of the delay time.
[0104] On the basis of the above embodiment, the timestamp includes two groups of first timestamps and second timestamps corresponding to the transmission of data packets from the first system to the second system, and two groups of third timestamps and fourth timestamps corresponding to the transmission of response data packets from the second system to the first system. The preset condition is that the first difference of one group is different from the second difference, and is different from the first difference of the other group. According to the relationship between each timestamp difference and the preset condition, the delay strategy of the dual system is determined to obtain the delay time, including:
[0105] Determine whether the first difference value of one of the groups is the same as the corresponding second difference value;
[0106] If the first difference value of one of the groups is different from the corresponding second difference value, determining whether the first difference value of one of the groups is the same as the first difference value of the other group;
[0107] If the first difference value of one group is different from the first difference value of the other group, determining the delay state of the dual systems as a transmission delay and a sending delay;
[0108] Subtract the first timestamp and the fourth timestamp corresponding to the two groups from each other to obtain a third difference value;
[0109] Subtract the second timestamp and the third timestamp corresponding to the two groups from each other to obtain a fourth difference value;
[0110] Subtracting the third difference value and the fourth difference value corresponding to each group to obtain the first two-way delay time of the dual system and determine the first one-way delay time of the dual system;
[0111] The first one-way delay time of each group is averaged to obtain the delay time of the dual system.
[0112] Specifically, in order to improve the accuracy of determining the delay time, the timestamp includes two groups of first timestamps and second timestamps corresponding to the transmission of data packets from the first system to the second system, and two groups of third timestamps and fourth timestamps corresponding to the transmission of response data packets from the second system to the first system. That is, one group of first timestamps and second timestamps for transmitting data packets from the first system to the second system, one group of third timestamps and fourth timestamps for transmitting response data packets from the second system to the first system, one group of fifth timestamps and sixth timestamps for transmitting data packets from the first system to the second system, and one group of seventh timestamps and eighth timestamps for transmitting response data packets from the second system to the first system.
[0113] Determine whether the first difference value of one of the groups is the same as the corresponding second difference value. If different, it is determined that a transmission delay occurs in the dual systems. Further, determine whether the first difference value of one of the groups is the same as the first difference value of the other group; that is, whether the first difference value and the fifth difference value formed by the fifth timestamp and the sixth timestamp are the same. If different, it is determined that a transmission delay occurs in the dual systems.
[0114] Furthermore, the method for determining the four groups of bidirectional transmissions in this embodiment is the same as the method for determining the two groups of bidirectional transmissions in the above embodiment. The delay time of each two groups is first calculated, and the delay time of the two groups is averaged to obtain the delay time of the dual system.
[0115] It should be noted that this embodiment only calculates timestamps for four groups. There may also be timestamps greater than four groups, that is, multiples of 4. The calculation method is the same. The delay time corresponding to every two groups is first calculated, and then the average processing is performed to obtain the delay time of the dual systems. The more timestamps there are, the more accurate the determined delay time is. Of course, the computing power of the current terminal device also needs to be considered, and no specific limitation is made here.
[0116] The eight time stamps of bidirectional transmission provided by the embodiment of the present invention effectively avoid the problem of error in the existing delay time determined by unidirectional transmission, and improve the accuracy of the delay time.
[0117] Based on the above embodiment, the transmission protocols used in the bidirectional transmission process need to match the same, that is, the transmission protocol for transmitting the data packet from the first system to the second system is the same as the transmission protocol for transmitting the response data packet from the second system to the first system, and the transmission protocol is the SPI communication protocol or the I2C communication protocol.
[0118] Specifically, if a group of transmission data packets is a serial peripheral interface (SPI) communication protocol, the transmission process of the response frame of the feedback response data packet also needs to be the SPI communication protocol. Similarly, if a group of transmission data packets is an integrated circuit bus (I2C) communication protocol, the transmission process of the feedback response frame also needs to be the I2C communication protocol.
[0119] In addition to the above two bus protocols, other communication protocols may also be used, which are not specifically limited here.
[0120] The transmission protocol for transmitting data packets from the first system to the second system provided in the embodiment of the present invention is the same as the transmission protocol for transmitting response data packets from the second system to the first system, and the transmission protocol is the SPI communication protocol or the I2C communication protocol, so that the delay time obtained is accurate.
[0121] Based on the above embodiment, after determining the delay time, the method further includes:
[0122] Send the delay time to the kernel of the terminal device;
[0123] Controls the input subsystem to send the delay time at the kernel to the display device of the terminal device for display.
[0124] Specifically, four timestamps are generated each time a packet is sent. These four timestamps can be used to calculate the delay of a data packet. The data is passed to the kernel and sent to the upper layer through the input subsystem. The upper-layer UI obtains the delay time data and updates it in real time. In this way, R&D and testing can view the delay size of the data at a certain moment in real time, and there is no need to judge through the LOG, which saves a lot of time for R&D and testing.
[0125] The embodiment of the present invention provides a method for sending the delay time to the kernel of the terminal device; controlling the input subsystem to send the delay time at the kernel to the display device of the terminal device for display. The delay time data is displayed in real time, which greatly reduces the time for research and development and testing and debugging.
[0126] The above describes in detail various embodiments corresponding to the method for determining the delay time of the dual system. On this basis, the present invention also discloses a device for determining the delay time of the dual system corresponding to the above method. Figure 3 The structure diagram of a dual-system delay time determination device provided by an embodiment of the present invention. Figure 3 As shown, the device for determining the delay time of the dual system includes:
[0127] The acquisition device 11 is used to acquire the timestamps of the transmission data in the dual systems, wherein the timestamps include at least a set of first timestamps and second timestamps of the data packet transmitted from the first system to the second system, and a set of third timestamps and fourth timestamps of the response data packet transmitted from the second system to the first system;
[0128] A first determining module 12, configured to determine the difference between each time stamp according to the corresponding relationship between each time stamp of each group;
[0129] The second determination module 13 is used to determine the delay strategy of the dual systems to obtain the delay time according to the relationship between each time stamp difference and the preset condition when each time stamp difference satisfies the preset condition.
[0130] Since the embodiments of the device part correspond to the above embodiments, please refer to the description of the embodiments of the method part for the embodiments of the device part, and will not be repeated here.
[0131] For an introduction to a dual-system delay time determination device provided by the present invention, please refer to the above method embodiment, which will not be described in detail herein. The dual-system delay time determination method has the same beneficial effects as the above method.
[0132] Figure 4 A structural diagram of a terminal device provided by an embodiment of the present invention, such as Figure 4 As shown, the device comprises:
[0133] A memory 21, used for storing computer programs;
[0134] The processor 22 is used to implement the steps of the method for determining the delay time of the dual systems when executing a computer program.
[0135] The terminal device provided in this embodiment may include but is not limited to a wearable device, a smart phone, a tablet computer, a laptop computer or a desktop computer.
[0136] Among them, the processor 22 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 22 can be implemented in at least one hardware form of a digital signal processor (DSP), a field-programmable gate array (FPGA), and a programmable logic array (PLA). The processor 22 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU; the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 22 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 22 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0137] The memory 21 may include one or more computer-readable storage media, which may be non-transitory. The memory 21 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 21 is at least used to store the following computer program 211, wherein, after the computer program is loaded and executed by the processor 22, the relevant steps of the method for determining the delay time of the dual system disclosed in any of the aforementioned embodiments can be implemented. In addition, the resources stored in the memory 21 may also include an operating system 212 and data 213, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system 212 may include Windows, Unix, Linux, etc. The data 213 may include but is not limited to the data involved in the method for determining the delay time of the dual system, etc.
[0138] In some embodiments, the terminal device may further include a display screen 23 , an input / output interface 24 , a communication interface 25 , a power supply 26 , and a communication bus 27 .
[0139] Those skilled in the art can understand that Figure 4 The structure shown in the figure does not constitute a limitation on the terminal device, and may include more or fewer components than those shown in the figure.
[0140] The processor 22 calls the instructions stored in the memory 21 to implement the method for determining the delay time of the dual systems provided in any of the above embodiments.
[0141] For an introduction to a terminal device provided by the present invention, please refer to the above method embodiment, which will not be described in detail herein. It has the same beneficial effects as the above dual-system delay time determination method.
[0142] The above is a detailed introduction to a dual-system delay time determination method, device and terminal equipment provided by the present invention. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referenced to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principle of the present invention, several improvements and modifications can be made to the present invention, and these improvements and modifications also fall within the scope of protection of the claims of the present invention.
[0143] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises", "comprising" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
Claims
1. A method for determining the delay time of a dual system, characterized in that: Applied to terminal equipment, including: Acquire timestamps of transmission data in the dual systems, wherein the timestamps include at least a set of first timestamps and second timestamps for transmitting a data packet from the first system to the second system, and a set of third timestamps and fourth timestamps for transmitting a response to the data packet from the second system to the first system; Determine the difference between the timestamps according to the corresponding relationship between the timestamps of each group; When each of the timestamp differences meets a preset condition, determining the delay strategy of the dual systems according to the relationship between each of the timestamp differences and the preset condition to obtain the delay time; Correspondingly, the process of establishing the first timestamp and the second timestamp of transmitting the data packet from the first system to the second system includes the following steps: Acquire the data packet of the first system, and record the sending time of the data packet as the first timestamp; controlling the first system to send the data packet to the second system; Controlling the second system to record the reception completion time of the data packet as the second timestamp; Correspondingly, the process of establishing the third timestamp and the fourth timestamp of transmitting the response data packet from the second system to the first system includes the following steps: Control the second system to generate a response frame for responding to the data packet according to the data packet, record the sending time of the response frame as the third timestamp, and send the response frame, the second timestamp and the third timestamp to the first system; Control the first system to record the reception completion time of the response frame, the second timestamp and the third timestamp as the fourth timestamp; Correspondingly, the preset condition is that the first difference is different from the second difference, the first timestamp is subtracted from the second timestamp to obtain the first difference, and the third timestamp is subtracted from the fourth timestamp to obtain the second difference, and the delay strategy of the dual system is determined according to the relationship between the timestamp differences and the preset condition to obtain the delay time, including: Determining whether the first difference is the same as the second difference; If they are different, determining that the delay state of the dual systems is a transmission delay; Subtracting the first timestamp from the fourth timestamp to obtain a third difference value; Subtracting the second timestamp from the third timestamp to obtain a fourth difference value; Subtracting the third difference from the fourth difference to obtain a first two-way delay time of the dual system; Dividing the first two-way delay time by 2 to determine the first one-way delay time of the dual system; The first one-way delay time is used as the delay time of the dual systems.
2. The method for determining the delay time of the dual system according to claim 1, characterized in that: The timestamp further includes a set of fifth timestamp and sixth timestamp for transmitting the data packet from the first system to the second system, the preset condition is that the first difference is different from the fifth difference, wherein the fifth timestamp is different from the first timestamp, and the fifth difference is obtained by subtracting the fifth timestamp from the sixth timestamp, and determining the delay strategy of the dual systems to obtain the delay time according to the relationship between the timestamp differences and the preset condition, includes: Determining whether the first difference is the same as the fifth difference; If they are different, determining that the delay state of the dual systems is a sending delay; The first difference, the second difference and the fifth difference are averaged to obtain the delay time of the dual system.
3. The method for determining the delay time of the dual system according to claim 1, characterized in that: The timestamps include two groups of the first timestamps and the second timestamps for correspondingly transmitting the data packets from the first system to the second system, and two groups of the third timestamps and the fourth timestamps for correspondingly transmitting the response data packets from the second system to the first system, the preset condition is that the first difference of one group is different from the second difference, and is different from the first difference of the other group, and determining the delay strategy of the dual systems to obtain the delay time according to the relationship between the timestamp differences and the preset condition, includes: Determine whether the first difference value of one of the groups is the same as the corresponding second difference value; If the first difference value of one of the groups is different from the corresponding second difference value, determining whether the first difference value of one of the groups is the same as the first difference value of the other group; If the first difference of one of the groups is different from the first difference of the other group, determining that the delay state of the dual system is a transmission delay and a sending delay; Subtract the first timestamp and the fourth timestamp corresponding to the two groups to obtain a third difference value; Subtract the second timestamp and the third timestamp respectively corresponding to the two groups to obtain a fourth difference value; Subtracting the third difference corresponding to each group from the fourth difference to obtain the first two-way delay time of the dual system to determine the first one-way delay time of the dual system; The first one-way delay time of each group is averaged to obtain the delay time of the dual system.
4. The method for determining the delay time of the dual system according to claim 1, characterized in that: The transmission protocol for transmitting the data packet from the first system to the second system is the same as the transmission protocol for transmitting the response data packet from the second system to the first system, and the transmission protocol is the SPI communication protocol or the I2C communication protocol.
5. The method for determining the delay time of a dual system according to any one of claims 1 to 4, characterized in that: After determining the delay time, the method further includes: Sending the delay time to the kernel of the terminal device; The input subsystem is controlled to send the delay time at the kernel to the display device of the terminal equipment for display.
6. A device for determining the delay time of a dual system, characterized in that: include: An acquisition device, used for acquiring the timestamps of the transmission data in the dual systems, wherein the timestamps include at least a set of first timestamps and second timestamps for transmitting a data packet from the first system to the second system, and a set of third timestamps and fourth timestamps for transmitting a response to the data packet from the second system to the first system; A first determining module, configured to determine the difference between each time stamp according to the corresponding relationship between each time stamp of each group; A second determination module is used to determine the delay strategy of the dual system to obtain the delay time according to the relationship between each of the timestamp differences and the preset condition when each of the timestamp differences meets the preset condition; Correspondingly, the process of establishing the first timestamp and the second timestamp of transmitting the data packet from the first system to the second system includes the following steps: Acquire the data packet of the first system, and record the sending time of the data packet as the first timestamp; controlling the first system to send the data packet to the second system; Controlling the second system to record the reception completion time of the data packet as the second timestamp; Correspondingly, the process of establishing the third timestamp and the fourth timestamp of transmitting the response data packet from the second system to the first system includes the following steps: Control the second system to generate a response frame for responding to the data packet according to the data packet, record the sending time of the response frame as the third timestamp, and send the response frame, the second timestamp and the third timestamp to the first system; Control the first system to record the reception completion time of the response frame, the second timestamp and the third timestamp as the fourth timestamp; Correspondingly, the preset condition is that the first difference is different from the second difference, the first timestamp is subtracted from the second timestamp to obtain the first difference, and the third timestamp is subtracted from the fourth timestamp to obtain the second difference, and the delay strategy of the dual system is determined according to the relationship between the timestamp differences and the preset condition to obtain the delay time, including: Determining whether the first difference is the same as the second difference; If they are different, determining that the delay state of the dual systems is a transmission delay; Subtracting the first timestamp from the fourth timestamp to obtain a third difference value; Subtracting the second timestamp from the third timestamp to obtain a fourth difference value; Subtracting the third difference from the fourth difference to obtain a first two-way delay time of the dual system; Dividing the first two-way delay time by 2 to determine the first one-way delay time of the dual system; The first one-way delay time is used as the delay time of the dual systems.
7. A terminal device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the method for determining the delay time of the dual system as claimed in any one of claims 1 to 5 when executing the computer program.
Citation Information
Patent Citations
Dual-board system time synchronization method
CN105376043A
Optimization method for time synchronization of PTP in asymmetric network
CN111342926A