Clock synchronization method, equipment and storage medium

文档序号:588682 发布日期:2021-05-25 浏览:4次 中文

阅读说明:本技术 一种时钟同步方法、设备及存储介质 (Clock synchronization method, equipment and storage medium ) 是由 宋晓琴 邱文才 黄钧 田学红 林满院 于 2020-12-31 设计创作,主要内容包括:本发明公开了一种时钟同步方法、设备及存储介质。该方法应用于时钟同步网络中的主节点设备,包括端口芯片和设备处理器;该方法包括:通过端口芯片从节点设备发送时钟同步报文,并确定发送时钟同步报文的第一时间戳;设备处理器基于第一时间戳形成跟随报文,并通过端口芯片发送至从节点设备,其中,第一时间戳由端口芯片回传至设备处理器;通过端口芯片接收从节点设备发送的延时请求报文,并确定接收延时请求报文的第四时间戳;设备处理器将第四时间戳形成延迟请求响应报文,并通过端口芯片发送至从节点设备,同步从节点设备的设备时钟。本发明由端口芯片主动回传时间戳,实现在时钟同步操作中,减少设备处理器的中断次数和SPI通路,提高处理效率。(The invention discloses a clock synchronization method, clock synchronization equipment and a storage medium. The method is applied to main node equipment in a clock synchronization network and comprises a port chip and an equipment processor; the method comprises the following steps: sending a clock synchronization message from the node equipment through a port chip, and determining a first timestamp for sending the clock synchronization message; the device processor forms a following message based on the first time stamp and sends the following message to the slave node device through the port chip, wherein the first time stamp is transmitted back to the device processor through the port chip; receiving a delay request message sent from the node equipment through the port chip, and determining a fourth timestamp for receiving the delay request message; and the device processor forms a delay request response message by the fourth timestamp, sends the delay request response message to the slave node device through the port chip, and synchronizes the device clock of the slave node device. The invention actively transmits the timestamp back by the port chip, realizes the purpose of reducing the interruption times and the SPI path of the equipment processor in the clock synchronization operation, and improves the processing efficiency.)

1. A clock synchronization method is applied to a main node device in a clock synchronization network, wherein the main node device comprises a port chip and a device processor;

characterized in that the method comprises:

sending a clock synchronization message from the node equipment through the port chip, and determining a first timestamp for sending the clock synchronization message;

the device processor forms a following message based on the first timestamp and sends the following message to the slave node device through the port chip, wherein the first timestamp is transmitted back to the device processor by the port chip;

receiving a delay request message sent by the slave node equipment through the port chip, and determining a fourth timestamp for receiving the delay request message;

and the equipment processor forms a delay request response message with the fourth timestamp, and sends the delay request response message to the slave node equipment through the port chip to synchronize the equipment clock of the slave node equipment.

2. The clock synchronization method according to claim 1, wherein the step of passing back the first timestamp comprises:

and the port chip acquires the message identification information of the clock synchronization message, forms a first timestamp return message by combining the first timestamp, and returns the first timestamp return message to the equipment processor.

3. The clock synchronization method of claim 2, wherein the packet identification information comprises a device identification number, a port identification number, and a packet sequence number.

4. A clock synchronization method is applied to a slave node device in a clock synchronization network, and the slave node device comprises a port chip and a device processor;

characterized in that the method comprises:

receiving a clock synchronization message and a following message sent by a master node device through the port chip, and determining a second timestamp for receiving the clock synchronization message;

sending a delay request message to the master node device through the port chip, and determining a third timestamp for sending the delay request message, wherein the third timestamp is transmitted back to the device processor by the port chip;

receiving a delay request response message returned by the main node equipment through the port chip;

the device processor analyzes the following message and the delay request response message to obtain a first time stamp and a fourth time stamp, obtains a clock deviation value according to the first time stamp, the second time stamp, the third time stamp and the fourth time stamp, and synchronizes a device clock based on the clock deviation value.

5. The clock synchronization method according to claim 4, wherein the step of passing back the third timestamp comprises:

and the port chip acquires the message identification information of the delay request message, forms a third timestamp return message by combining the third timestamp, and returns the third timestamp return message to the equipment processor.

6. The clock synchronization method of claim 5, wherein the packet identification information comprises a device identification number, a port identification number, and a packet sequence number.

7. The clock synchronization method of claim 4, wherein the port chip fills the second timestamp into the clock synchronization message and sends the clock synchronization message to the device processor.

8. The method of claim 4, wherein deriving a clock bias value from the first timestamp, the second timestamp, the third timestamp, and the fourth timestamp comprises:

subtracting the first time stamp from the second time stamp to obtain a first time difference;

subtracting the second timestamp from the fourth timestamp to obtain a second time difference;

and determining a time difference value of the first time difference and the second time difference, and determining half of the time difference value as a clock deviation value.

9. A computer device, the device comprising:

one or more processors;

a memory for storing one or more programs;

the port chip is used for carrying out information interaction with external equipment;

when executed by the one or more processors, cause the one or more processors to implement the clock synchronization method of any of claims 1-8.

10. A storage medium containing computer-executable instructions for performing the clock synchronization method of any one of claims 1-8 when executed by a computer processor.

Technical Field

Embodiments of the present invention relate to information processing technologies, and in particular, to a clock synchronization method, a clock synchronization device, and a storage medium.

Background

When the 1588 protocol is used for clock synchronization of the equipment, the master clock equipment sends a clock synchronization message to the slave clock equipment, the slave clock equipment sends a delay request message to the master clock equipment, and the master clock equipment sends a delay request response message to the slave clock equipment.

Generally, a first timestamp is marked when the master clock equipment sends a clock synchronization message, the first timestamp is packaged into a following message and sent to the slave clock equipment, and a second timestamp is marked when the slave clock equipment receives the clock synchronization message; and the slave clock device calculates the clock deviation between the master device clock and the slave device clock through the first time stamp, the second time stamp, the third time stamp and the fourth time stamp and corrects the clock deviation. In the process, a Phy chip or an FPGA in the clock device is generally used for stamping the time stamp, after the Phy chip or the FPGA stamps the time stamp, the time stamp is stored in the Fifo memory and triggered to be interrupted, and after the CPU receives the interruption, the CPU reads the time stamp through the SPI interface. The first time stamp, the second time stamp and the fourth time stamp are all transmitted to a CPU of the slave clock device through messages, the third time stamp is determined by a Phy chip or an FPGA, and after triggering interruption by the Phy chip or the FPGA, the CPU reads through an SPI interface. It can be seen that, in order to obtain the third timestamp, an SPI path needs to be added, and meanwhile, the CPU processes the interrupt of the third timestamp in real time, which also affects the utilization efficiency of the CPU. Similarly, the master clock device also has this problem in acquiring the first time stamp.

Disclosure of Invention

The invention provides a clock synchronization method, a device and a storage medium, which are used for reducing the interrupt times and SPI (serial peripheral interface) paths of a node device processor and improving the processing efficiency of the device in clock synchronization operation.

In a first aspect, an embodiment of the present invention provides a clock synchronization method, which is applied to a master node device in a clock synchronization network, where the master node device includes a port chip and a device processor; the method comprises the following steps:

sending a clock synchronization message from the node equipment through the port chip, and determining a first timestamp for sending the clock synchronization message;

the device processor forms a following message based on the first timestamp and sends the following message to the slave node device through the port chip, wherein the first timestamp is transmitted back to the device processor by the port chip;

receiving a delay request message sent by the slave node equipment through the port chip, and determining a fourth timestamp for receiving the delay request message;

and the equipment processor forms a delay request response message with the fourth timestamp, and sends the delay request response message to the slave node equipment through the port chip to synchronize the equipment clock of the slave node equipment.

Optionally, the step of returning the first timestamp includes:

and the port chip acquires the message identification information of the clock synchronization message, forms a first timestamp return message by combining the first timestamp, and returns the first timestamp return message to the equipment processor.

Optionally, the message identification information includes an equipment identification number, a port identification number, and a message serial number.

In a second aspect, an embodiment of the present invention further provides a clock synchronization method, which is applied to a slave node device in a clock synchronization network, where the slave node device includes a port chip and a device processor, and the method includes:

receiving a clock synchronization message and a following message sent by a master node device through the port chip, and determining a second timestamp for receiving the clock synchronization message;

sending a delay request message to the master node device through the port chip, and determining a third timestamp for sending the delay request message, wherein the third timestamp is transmitted back to the device processor by the port chip;

receiving a delay request response message returned by the main node equipment through the port chip;

the device processor analyzes the following message and the delay request response message to obtain a first time stamp and a fourth time stamp, obtains a clock deviation value according to the first time stamp, the second time stamp, the third time stamp and the fourth time stamp, and synchronizes a device clock based on the clock deviation value.

Optionally, the returning step of the third timestamp includes:

and the port chip acquires the message identification information of the delay request message, forms a third timestamp return message by combining the third timestamp, and returns the third timestamp return message to the equipment processor.

Optionally, the message identification information includes an equipment identification number, a port identification number, and a message serial number.

Optionally, the port chip fills the second timestamp into the clock synchronization message and sends the clock synchronization message to the device processor.

Optionally, the obtaining a clock offset value according to the first timestamp, the second timestamp, the third timestamp, and the fourth timestamp includes:

subtracting the first time stamp from the second time stamp to obtain a first time difference;

subtracting the second timestamp from the fourth timestamp to obtain a second time difference;

and determining a time difference value of the first time difference and the second time difference, and determining half of the time difference value as a clock deviation value.

In a third aspect, an embodiment of the present invention further provides a computer device, including:

one or more processors;

a memory for storing one or more programs;

the port chip is used for carrying out information interaction with external equipment;

when executed by the one or more processors, cause the one or more processors to implement a method of clock synchronization as in any embodiment of the invention.

In a fourth aspect, embodiments of the present invention further provide a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a clock synchronization method according to any of the embodiments of the present invention.

The invention is applied to the main node equipment in the clock synchronization network, and the main node equipment comprises a port chip and an equipment processor; sending a clock synchronization message from the node equipment through a port chip, and determining a first timestamp for sending the clock synchronization message; the device processor forms a following message based on the first time stamp and sends the following message to the slave node device through the port chip, wherein the first time stamp is transmitted back to the device processor through the port chip; receiving a delay request message sent from the node equipment through the port chip, and determining a fourth timestamp for receiving the delay request message; and the device processor forms a delay request response message by the fourth timestamp, sends the delay request response message to the slave node device through the port chip, and synchronizes the device clock of the slave node device. According to the invention, the port chip of the main node equipment actively transmits the timestamp back to the equipment processor, so that the interrupt times and the SPI (serial peripheral interface) access of the equipment processor are reduced in the clock synchronization operation, and the processing efficiency is improved.

Drawings

Fig. 1 is a flowchart of a clock synchronization method according to an embodiment of the present invention;

fig. 2 is a flowchart of a clock synchronization method according to a second embodiment of the present invention;

FIG. 3 is a schematic diagram of a clock synchronization method according to a second embodiment of the present invention;

fig. 4 is a block diagram of a computer device according to a third embodiment of the present invention.

Detailed Description

The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be noted that, for convenience of description, only a part of the structures related to the present invention, not all of the structures, are shown in the drawings, and furthermore, embodiments of the present invention and features of the embodiments may be combined with each other without conflict.

Example one

Fig. 1 is a flowchart of a clock synchronization method according to an embodiment of the present invention, where the embodiment is applicable to a master node device in a clock synchronization network, and the master node device may include a port chip and a device processor. The method may be performed by a clock synchronization apparatus, which may be implemented by software and/or hardware.

As shown in fig. 1, the method specifically includes the following steps:

step 110, the slave node device sends the clock synchronization message through the port chip, and determines a first timestamp for sending the clock synchronization message.

In the synchronization process of the clock synchronization system, a master clock periodically issues PTP time synchronization and time information, a slave clock port receives timestamp information sent by the master clock port, the system calculates master-slave line time delay and master-slave time difference according to the information, and adjusts local time by using the time difference, so that slave equipment time keeps frequency and phase consistent with master equipment time. In this embodiment, a device for performing a master clock function may be referred to as a master node device, and a device for performing a slave clock function may be referred to as a slave node device. The port chip can be a physical interface transceiver chip or a programmable interface chip, such as a Phy chip or an FPGA chip.

Specifically, in the synchronization process of the clock synchronization system, a device processor of the master node device may form a clock synchronization packet, the device processor transmits the clock synchronization packet to the port chip, and the port chip transmits the clock synchronization packet to the slave node device after a first timestamp is marked.

And step 120, the device processor forms a following message based on the first timestamp, and sends the following message to the slave node device through the port chip, wherein the first timestamp is transmitted back to the device processor by the port chip.

Specifically, after a first timestamp is printed on a port chip of the main node device, the first timestamp can be filled into the return message and returned to the device processor of the main node device, the device processor analyzes the return message and then obtains the first timestamp, a following message is formed according to the first timestamp and transmitted to the port chip, and the port chip sends the following message to the slave node device.

Optionally, the returning step of the first timestamp may include:

the port chip acquires message identification information of the clock synchronization message, forms a first timestamp return message by combining the first timestamp, and returns the first timestamp return message to the device processor.

Further, the message identification information may include a device identification number, a port identification number, and a message serial number.

Step 130, receiving the delay request message sent from the node device through the port chip, and determining a fourth timestamp for receiving the delay request message.

Specifically, after receiving a clock synchronization message sent by the master node device, the slave node device returns a delay request message to the master node device, and the master node device receives the delay request message through the port chip, stamps a fourth timestamp when receiving the message, fills the fourth timestamp into the delay request message, and transmits the delay request message to the device processor of the master node device.

Step 140, the device processor forms a delay request response message from the fourth timestamp, and sends the delay request response message to the slave node device through the port chip, so as to synchronize the device clock of the slave node device.

Specifically, the device processor may analyze the delay request packet to obtain a fourth timestamp, and form a delay request response packet according to the fourth timestamp, and transmit the delay request response packet to the port chip, where the port chip sends the delay request response packet to the slave node device, so that the slave node device calculates a clock offset value existing between the master node device and the slave node device according to the transceiving time of the clock synchronization packet and the delay request packet, so as to adjust the clock of the slave node device, and synchronize the clocks of the master node device and the slave node device.

Illustratively, a CPU of the master node device forms a Sync message, and the CPU transmits the Sync message to a Phy chip or an FPGA chip of the master node device, and the Phy chip or the FPGA chip stamps a timestamp T1 and transmits the Sync message to the slave node device. Meanwhile, the Phy chip or the FPGA chip of the master node device saves the source MAC address, sourceportidentity, and sequence id of the Sync message, forms a local _ follow _ up message in combination with the timestamp T1, and transmits the local _ follow _ up message back to the CPU of the master node device. The 1588 protocol defines a packet format of a follow _ up packet, and the local _ follow _ up packet may be consistent with the follow _ up format defined by the 1588 protocol, as shown in the following table.

TABLE 1 local _ follow _ up message format

And after receiving the Sync message, the slave node equipment sends a delay-request message to the master node equipment. And when the Phy chip or the FPGA chip of the main node equipment receives the delay-request message, stamping a time stamp T4, filling the time stamp T4 in the tail of the delay-request message and bringing the time stamp T4 back to the CPU of the main node equipment. And the CPU of the master node equipment analyzes and processes the delay-request message to obtain a time stamp T4, and after a delay-response message is formed, the delay-response message is sent to the slave node equipment through a Phy chip or an FPGA chip so as to synchronize the equipment clock of the slave node equipment.

The technical scheme of the embodiment is applied to the main node equipment in the clock synchronization network, wherein the main node equipment comprises a port chip and an equipment processor; sending a clock synchronization message from the node equipment through a port chip, and determining a first timestamp for sending the clock synchronization message; the device processor forms a following message based on the first time stamp and sends the following message to the slave node device through the port chip, wherein the first time stamp is transmitted back to the device processor through the port chip; receiving a delay request message sent from the node equipment through the port chip, and determining a fourth timestamp for receiving the delay request message; and the device processor forms a delay request response message by the fourth timestamp, sends the delay request response message to the slave node device through the port chip, and synchronizes the device clock of the slave node device. According to the invention, the port chip of the main node equipment actively transmits the timestamp back to the equipment processor, so that the interrupt times and the SPI (serial peripheral interface) access of the equipment processor are reduced in the clock synchronization operation, and the processing efficiency is improved.

Example two

Fig. 2 is a flowchart of a clock synchronization method according to a second embodiment of the present invention. The embodiment can be applied to the slave node device in the clock synchronization network, and the slave node device can comprise a port chip and a device processor. The method may be performed by a clock synchronization apparatus, which may be implemented by software and/or hardware.

As shown in fig. 2, the method specifically includes the following steps:

step 210, receiving the clock synchronization message and the following message sent by the master node device through the port chip, and determining a second timestamp for receiving the clock synchronization message.

Optionally, the port chip fills the second timestamp into the clock synchronization packet and sends the clock synchronization packet to the device processor.

The port chip may be a physical interface transceiver chip or a programmable interface chip, such as a Phy chip or an FPGA chip.

Specifically, in the synchronization process of the clock synchronization system, a port chip of the slave node device may receive a clock synchronization packet sent by the master node device, and when receiving the clock synchronization packet, a second timestamp is stamped, and the second timestamp is filled in the clock synchronization packet and transmitted to the device processor of the slave node device. Since the first timestamp printed when the master node device transmits the clock synchronization packet is filled in the following packet, the port chip of the slave node device needs to receive the following packet transmitted by the master node device and transmit the following packet to the device processor of the slave node device.

Step 220, sending the delay request message to the master node device through the port chip, and determining a third timestamp for sending the delay request message, wherein the third timestamp is transmitted back to the device processor by the port chip.

Specifically, after receiving the clock synchronization message sent by the master node device, the slave node device returns a delay request message to the master node device. The delay request message may be formed by a device processor of the slave node device, and sent to the master node device through the port chip, and a third timestamp may be stamped when the delay request message is sent. Meanwhile, the port chip may fill a third timestamp into the return message, which is returned to the device processor of the slave node device.

Optionally, the returning step of the third timestamp may include:

the port chip acquires the message identification information of the delay request message, forms a third timestamp return message by combining with a third timestamp, and returns the third timestamp return message to the device processor.

Further, the message identification information may include a device identification number, a port identification number, and a message serial number.

Step 230, receiving a delay request response message returned by the master node device through the port chip.

Specifically, after receiving the delay request message sent by the slave node device, the master node device fills the delay request response message with a fourth timestamp of the received delay request message, and returns the delay request response message to the slave node device. The port chip of the slave node device may receive the deferred request response message and transmit to the device processor of the slave node device.

Step 240, the device processor analyzes the follow-up message and the delay request response message to obtain a first timestamp and a fourth timestamp, obtains a clock deviation value according to the first timestamp, the second timestamp, the third timestamp and the fourth timestamp, and synchronizes the device clock based on the clock deviation value.

Specifically, the device processor of the slave node device may parse the packet after receiving the follow packet and the delay request response packet, obtain a corresponding first timestamp and a fourth timestamp, calculate a clock offset value existing between the master node device and the slave node device in combination with the second timestamp filled in the clock synchronization packet and the third timestamp returned, and adjust the device clock of the slave node device according to the clock offset value, so as to synchronize the clocks of the master node device and the slave node device.

Optionally, obtaining a clock offset value according to the first time stamp, the second time stamp, the third time stamp, and the fourth time stamp includes:

subtracting the first time stamp from the second time stamp to obtain a first time difference;

subtracting the second time stamp from the fourth time stamp to obtain a second time difference;

and determining a time difference value of the first time difference and the second time difference, and determining half of the time difference value as a clock deviation value.

Illustratively, after the master node device sends the Sync message to the slave node device, the Phy chip or the FPGA chip of the slave node device receives the Sync message, stamps a timestamp T2, and fills the timestamp T2 in the tail of the Sync message to bring the Sync message back to the CPU of the slave node device. The CPU of the slave node equipment forms a delay-request message, sends the delay-request message to a Phy chip or an FPGA chip of the slave node equipment, stamps a timestamp T3 on the Phy chip or the FPGA chip, and sends the delay-request message to the master node equipment; meanwhile, the Phy chip or the FPGA chip of the slave node device stores the source MAC address, sourcePortIdentify and sequenceId of the delay-request message, forms a local _ follow _ up message by combining with the timestamp T3, and transmits the local _ follow _ up message back to the CPU of the slave node device. The 1588 protocol defines a message format of a follow _ up message, and the local _ follow _ up message may be consistent with the follow _ up format defined by the 1588 protocol. When the master node device receives the delay-request message, a timestamp T4 is stamped, the timestamp T4 is filled in the delay-response message and sent to the slave node device, and a Phy chip or an FPGA chip of the slave node device receives the delay-response message and transmits the delay-response message to a CPU of the slave node device. The CPU of the slave node equipment analyzes each message to obtain time stamps T1, T2, T3 and T4. The transmission time of the Sync message from the master node device to the slave node device may be denoted as Path-ms, the transmission time of the delay-request from the slave node device to the master node device may be denoted as Path-sm, and the clock offset value between the master node device and the slave node device may be denoted as offset, so that T2-T1 is equal to Path-ms + offset, and T4-T3 is equal to Path-sm-offset, and when the bidirectional paths of the master node device and the slave node device are symmetric, the offset is equal to (T2-T1-T4 + T3)/2. And adjusting the device clock of the slave node device according to the clock offset value offset to synchronize the clocks of the master node device and the slave node device.

Fig. 3 is a schematic diagram of a clock synchronization method according to a second embodiment of the present invention. In a clock synchronization system, there may be a master node device and a plurality of slave node devices, and fig. 3 shows an interaction process of information between the master node device and the slave node devices by taking a master node device and a slave node device as an example, and accordingly, the same interaction flow may also be performed between the master node device and other slave node devices. As shown in fig. 3, the device processor of the master node device forms a clock synchronization packet and transmits the clock synchronization packet to the port chip, and the port chip transmits the clock synchronization packet to the slave node device after printing a first timestamp. And receiving the clock synchronization message by a port chip of the slave node equipment, stamping a second timestamp when receiving the clock synchronization message, filling the second timestamp into the clock synchronization message, and transmitting the clock synchronization message to the equipment processor of the slave node equipment. After a port chip of the main node equipment stamps a first timestamp, message identification information of a clock synchronization message is obtained, a first timestamp return message is formed by combining the first timestamp and is returned to the equipment processor, the first timestamp is obtained after the equipment processor analyzes the return message, a following message is formed according to the first timestamp and is transmitted to the port chip, and the port chip sends the following message to the slave node equipment. And the port chip of the slave node equipment receives the following message and then transmits the message to the equipment processor of the slave node equipment. And the device processor of the slave node device forms a delay request message, sends the delay request message to the master node device through the port chip, and stamps a third timestamp when the delay request message is sent, meanwhile, the port chip can obtain message identification information of the delay request message, and forms a third timestamp return message by combining with the third timestamp, and the third timestamp return message is returned to the device processor of the slave node device. And the main node equipment receives the delay request message through the port chip, stamps a fourth timestamp when receiving the message, fills the fourth timestamp into the delay request message and transmits the delay request message to the equipment processor of the main node equipment. The device processor of the master node device may parse the delay request packet to obtain a fourth time stamp, form a delay request response packet according to the fourth time stamp, and send the delay request response packet to the slave node device through the port chip. The port chip of the slave node device may receive the deferred request response message and transmit to the device processor of the slave node device. And analyzing each message by the equipment processor of the slave node equipment to obtain a corresponding first time stamp, a corresponding second time stamp, a corresponding third time stamp and a corresponding fourth time stamp, calculating to obtain a clock deviation value, and synchronizing the equipment clock based on the clock deviation value.

The technical scheme of the embodiment is applied to the slave node equipment in the clock synchronization network, wherein the slave node equipment comprises a port chip and an equipment processor; receiving a clock synchronization message and a following message sent by a master node device through a port chip, and determining a second timestamp for receiving the clock synchronization message; sending a delay request message to the main node equipment through the port chip, and determining a third timestamp for sending the delay request message, wherein the third timestamp is transmitted back to the equipment processor by the port chip; receiving a delay request response message returned by the main node equipment through the port chip; the device processor analyzes the following message and the delay request response message to obtain a first time stamp and a fourth time stamp, obtains a clock deviation value according to the first time stamp, the second time stamp, the third time stamp and the fourth time stamp, and synchronizes the device clock based on the clock deviation value. According to the invention, the port chip of the slave node device actively transmits the timestamp back to the device processor, so that the interrupt times and the SPI (serial peripheral interface) paths of the device processor are reduced in the clock synchronization operation, and the processing efficiency is improved.

EXAMPLE III

Fig. 4 is a block diagram of a computer device according to a third embodiment of the present invention, as shown in fig. 4, the computer device includes a processor 310, a memory 320, and a port chip 330; the number of the processors 310 in the computer device may be one or more, and one processor 310 is taken as an example in fig. 4; the processor 310, memory 320 and port chip 330 in the computer device may be connected by a bus or other means, as exemplified by the bus connection in fig. 4.

The memory 320 is a computer-readable storage medium for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the clock synchronization method in the embodiments of the present invention. The processor 310 executes various functional applications of the computer device and data processing by executing software programs, instructions, and modules stored in the memory 320, that is, the clock synchronization method described above is implemented.

The memory 320 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 320 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 320 may further include memory located remotely from the processor 310, which may be connected to a computer device through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.

The port chip 330 may be a physical interface transceiver chip or a programmable interface chip, such as a Phy chip or an FPGA chip.

Example four

A fourth embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor may be configured to perform a clock synchronization method, the method including:

sending a clock synchronization message from the node equipment through the port chip, and determining a first timestamp for sending the clock synchronization message;

the device processor forms a following message based on the first timestamp and sends the following message to the slave node device through the port chip, wherein the first timestamp is transmitted back to the device processor by the port chip;

receiving a delay request message sent by the slave node equipment through the port chip, and determining a fourth timestamp for receiving the delay request message;

and the equipment processor forms a delay request response message with the fourth timestamp, and sends the delay request response message to the slave node equipment through the port chip to synchronize the equipment clock of the slave node equipment.

The computer-executable instructions, when executed by a computer processor, may also be for performing another clock synchronization method comprising:

receiving a clock synchronization message and a following message sent by a master node device through the port chip, and determining a second timestamp for receiving the clock synchronization message;

sending a delay request message to the master node device through the port chip, and determining a third timestamp for sending the delay request message, wherein the third timestamp is transmitted back to the device processor by the port chip;

receiving a delay request response message returned by the main node equipment through the port chip;

the device processor analyzes the following message and the delay request response message to obtain a first time stamp and a fourth time stamp, obtains a clock deviation value according to the first time stamp, the second time stamp, the third time stamp and the fourth time stamp, and synchronizes a device clock based on the clock deviation value.

Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the operations of the method described above, and may also perform related operations in the clock synchronization method provided by any embodiment of the present invention.

From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.

It should be noted that, in the embodiment of the clock synchronization apparatus, each unit and each module included in the embodiment are only divided according to functional logic, but are not limited to the above division as long as the corresponding function can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.

It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:TSN网络延迟抖动测量装置及方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!