Command processing method and device, computer equipment and storage medium

By creating a priority command queue in the main device and processing emergency commands in a timely manner, the problem of emergency command processing delay in the existing technology is solved, and system security and response speed are improved.

CN118642999APending Publication Date: 2024-09-13SHANDONG YUNHAI GUOCHUANG CLOUD COMPUTING EQUIP IND INNOVATION CENT CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410841845.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-09-13

AI Technical Summary

Technical Problem

In the existing technology, emergency commands sent by the master device may not be processed in time, which reduces system security.

Method used

By obtaining the pending command in the main device and saving the emergency command to the priority command queue according to the command identification, the priority command queue is monitored in real time. When the priority command queue is not empty and the main device does not process the pending command, the priority command queue is obtained and processed. Process emergency commands in the priority command queue to ensure they are processed in a timely manner.

Benefits of technology

It achieves timely processing of emergency commands, improves system security and response speed, and ensures command processing efficiency in emergencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118642999A
    Figure CN118642999A
Patent Text Reader

Abstract

The invention relates to the technical field of communication, and discloses a command processing method and device, computer equipment and a storage medium, and the method comprises the steps: obtaining a to-be-processed command, the to-be-processed command comprises a command identifier, and when the command identifier represents that the to-be-processed command is an emergency command, storing the to-be-processed command as an emergency command in a priority command queue; monitoring a priority command queue in real time; when the priority command queue is not empty and the master device is not processing the to-be-processed command, acquiring a first to-be-executed command in the priority command queue; analyzing the first to-be-executed command to obtain first to-be-executed command information; the target slave device is determined based on the first to-be-executed command information, corresponding operation is executed on the target slave device to obtain feedback information sent by the target slave device, the master device communicates with the target slave device through the bus, the emergency command is processed preferentially, and system safety is guaranteed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a command processing method, device, computer equipment and storage medium. Background Art

[0002] With the increase in the number of sensor devices in modern mobile devices and the improvement in performance requirements, a new bus protocol (Improved Inter Integrated Circuit, referred to as I3C) came into being. The I3C bus can support more sensor devices, i.e. slave devices, on the same main line without adding additional logic signals to support interrupt or sleep mode.

[0003] In the related art, the master device communicates with the slave device through the I3C bus to realize data writing and reading. Among them, the I3C bus protocol processes the commands according to the order of the commands sent by the master device to the I3C bus, and realizes writing the data sent by the master device to the slave device or reading the data of the slave device and feeding it back to the master device.

[0004] However, in the case where the command sent by the master device is an emergency command, if the commands are processed according to the order in which they are sent, the emergency command may not be processed in time, thereby reducing system security. Summary of the invention

[0005] In view of this, the present invention provides a command processing method, apparatus, computer equipment and storage medium to solve the problem in the related art that emergency commands cannot be processed in time, thereby reducing system security.

[0006] In a first aspect, the present invention provides a command processing method, applied to a master device, the method comprising:

[0007] Obtaining a command to be processed, wherein the command to be processed includes a command identifier;

[0008] When the command identifier indicates that the pending command is an urgent command, the pending command is saved as an urgent command in a priority command queue;

[0009] monitoring the priority command queue in real time;

[0010] When the priority command queue is not empty and the master device is not processing a pending command, obtaining a first pending command in the priority command queue;

[0011] Parsing the first command to be executed to obtain first command information to be executed;

[0012] A target slave device is determined based on the first command information to be executed, and a corresponding operation is performed on the target slave device to obtain feedback information sent by the target slave device. The master device and the target slave device communicate through a bus.

[0013] The command processing method provided in this embodiment obtains the pending command, and when it is determined that the pending command is an urgent command according to the command identifier in the pending command, the pending command is saved as an urgent command in the priority command queue, and the priority command queue is monitored in real time. When the priority command queue is not empty and the master device is not processing the pending command, the first pending command in the priority command queue is obtained, the first pending command is parsed, the first pending command information is obtained, the target slave device is determined based on the first pending command information, and the corresponding operation is performed on the target slave device to obtain the feedback information sent by the target slave device. By saving the urgent command to the priority command queue, when the priority command queue is not empty and the master device is not processing the pending command, the urgent command in the priority command queue is processed, thereby achieving the effect of timely priority processing of urgent commands and ensuring system security.

[0014] In an optional embodiment, the method further includes:

[0015] When the priority command queue is not empty and the master device is processing a pending command, after the master device completes processing the pending command being processed, obtain the first pending command in the priority command queue, parse the first pending command to obtain first pending command information, determine the target slave device based on the first pending command information, perform corresponding operations on the target slave device, and obtain feedback information.

[0016] The command processing method provided in this embodiment processes the urgent commands in the priority command queue after the priority command queue is not empty and the master device has processed the pending commands being processed, thereby achieving the effect of timely and preferentially processing the urgent commands and ensuring the security of the system.

[0017] In an optional embodiment, the method further includes:

[0018] When the command identifier indicates that the command to be processed is a common command, the command to be processed is saved as a common command in a common command queue;

[0019] Monitoring the common command queue in real time;

[0020] When the priority command queue is empty and the common command queue is not empty, obtaining a second to-be-executed command in the common command queue;

[0021] Parsing the second command to be executed to obtain information of the second command to be executed;

[0022] A target slave device is determined based on the second command information to be executed, and a corresponding operation is performed on the target slave device to obtain feedback information.

[0023] The command processing method provided in this embodiment obtains the second command to be executed in the ordinary command queue when the priority command queue is empty and the ordinary command queue is not empty, parses the second command to be executed, obtains the second command information to be executed, determines the target slave device based on the second command information to be executed, and performs corresponding operations on the target slave device to obtain feedback information. When the priority command queue is empty, ordinary commands in the ordinary command queue are processed, thereby achieving the effect of giving priority to urgent commands.

[0024] In an optional embodiment, the method further includes:

[0025] When the command to be processed is an urgent command and the command type of the command to be processed is a read command, the obtained feedback information is cached in a priority data queue as data corresponding to the command to be processed;

[0026] When the pending command is an urgent command and the command type of the pending command is a write command, obtaining data corresponding to the pending command and caching the data corresponding to the pending command into a priority data queue;

[0027] When the command to be processed is a common command and the command type of the command to be processed is a read command, the obtained feedback information is cached in a common data queue as data corresponding to the command to be processed;

[0028] When the command to be processed is a common command and the command type of the command to be processed is a write command, data corresponding to the command to be processed is acquired, and the data corresponding to the command to be processed is cached in a common data queue.

[0029] The command processing method provided in this embodiment achieves orderly storage and efficient processing of data by caching the data corresponding to the command in the corresponding data queue, thereby improving the overall efficiency and response speed of the system.

[0030] In an optional implementation, the first command information to be executed includes a command type of the first command to be executed, a command transmission mode of the first command to be executed, and a command code corresponding to the first command to be executed, and determining a target slave device based on the first command information to be executed, and performing a corresponding operation on the target slave device to obtain feedback information sent by the target slave device includes:

[0031] In the case where the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is broadcast transmission, sending a broadcast header and waiting for a response from a target slave device, and in the case where the target slave device responds, sending a command code corresponding to the first command to be executed and data corresponding to the first command to be executed to the target slave device, so that the target slave device executes a write operation of the data corresponding to the first command to be executed based on the command code, and sends write completion information as feedback information to a master device;

[0032] In a case where the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is direct transmission, sending a broadcast header and waiting for a response from a slave device, and in a case where the slave device responds, sending a command code and a target slave device address corresponding to the first command to be executed to match a target slave device based on the target slave device address, and in a case where the target slave device responds, sending data corresponding to the first command to be executed to the target slave device so that the target slave device executes a write operation of the data corresponding to the first command to be executed, and sending write completion information as feedback information to a master device;

[0033] When the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is private transmission, a broadcast header and a target slave device address are sent to match the target slave device based on the target slave device address. When the target slave device responds, data corresponding to the first command to be executed is sent to the target slave device so that the target slave device executes a write operation on the data corresponding to the first command to be executed, and write completion information is sent to the master device as feedback information.

[0034] The command processing method provided in this embodiment determines the target slave device according to the command type and command transmission mode, thereby improving the efficiency of command execution. It supports three modes: broadcast transmission, direct transmission and private transmission, and can be applied to different transmission scenarios.

[0035] In an optional implementation manner, the first command information to be executed includes a command type of the first command to be executed, a command transmission mode of the first command to be executed, a command code corresponding to the first command to be executed, and a data length corresponding to the first command to be executed, and determining a target slave device based on the first command information to be executed, and performing a corresponding operation on the target slave device to obtain feedback information sent by the target slave device includes:

[0036] In a case where the command type of the first command to be executed is a read command and the command transmission mode of the first command to be executed is direct transmission, sending a broadcast header and waiting for a response from a slave device, and in a case where the slave device responds, sending a command code and a target slave device address corresponding to the first command to be executed, so as to match a target slave device based on the target slave device address, and in a case where the target slave device responds, reading data of the target slave device based on a data length corresponding to the first command to be executed, wherein the read data is feedback information;

[0037] When the command type of the first command to be executed is a read command and the command transmission mode of the first command to be executed is private transmission, a broadcast header and a target slave device address are sent to match the target slave device based on the target slave device address. When the target slave device responds, the data of the target slave device is read based on the data length corresponding to the first command to be executed.

[0038] The command processing method provided in this embodiment determines the target slave device according to the command type and command transmission mode, thereby improving the efficiency of command execution.

[0039] In an optional embodiment, the method further includes:

[0040] When the master device sends data to the target slave device via the bus, the data is converted into data in a format adapted to the bus.

[0041] The command processing method provided in this embodiment improves the efficiency of data transmission by converting data into data in a bus-adapting format when the master device sends data to the target slave device through the bus.

[0042] In a second aspect, the present invention provides a command processing device, the device comprising:

[0043] A first acquisition module, used for acquiring a command to be processed, wherein the command to be processed includes a command identifier;

[0044] A first saving module, configured to save the to-be-processed command as an urgent command to a priority command queue when the command identifier indicates that the to-be-processed command is an urgent command;

[0045] A first monitoring module, used for monitoring the priority command queue in real time;

[0046] A second acquisition module, configured to acquire a first to-be-executed command in the priority command queue when the priority command queue is not empty and the master device is not processing a to-be-processed command;

[0047] A first parsing module, used for parsing the first command to be executed to obtain first command information to be executed;

[0048] The first determination module is used to determine the target slave device based on the first command information to be executed, and perform corresponding operations on the target slave device to obtain feedback information sent by the target slave device. The master device and the target slave device communicate through a bus.

[0049] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the command processing method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0050] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the command processing method of the first aspect or any corresponding embodiment thereof.

[0051] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the command processing method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are 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.

[0053] Figure 1 is a flowchart of a command processing method according to an embodiment of the present invention;

[0054] Figure 2 is a schematic diagram of the structure of a command processing system according to an embodiment of the present invention;

[0055] Figure 3 is a flowchart of another command processing method according to an embodiment of the present invention;

[0056] Figure 4 It is a timing diagram for processing emergency commands according to the related art;

[0057] Figure 5 is a timing diagram of processing an emergency command according to an embodiment of the present invention;

[0058] Figure 6is a schematic diagram of a priority command queue and a priority data queue in a data cache module according to an embodiment of the present invention;

[0059] Figure 7 is a schematic diagram of a common command queue and a common data queue in a data cache module according to an embodiment of the present invention;

[0060] Figure 8 is a structural diagram of processing a write command according to an embodiment of the present invention;

[0061] Fig. 9 2 is a schematic diagram of data transmission of an I3C protocol write command according to an embodiment of the present invention;

[0062] Fig.10 2 is a schematic diagram of data transmission of an I2C protocol write command according to an embodiment of the present invention;

[0063] Fig.11 is a flowchart of another command processing method according to an embodiment of the present invention;

[0064] Fig.12 is a structural block diagram of a command processing device according to an embodiment of the present invention;

[0065] Fig.13 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0066] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0067] With the increase in the number of sensor devices in modern mobile devices and the improvement of performance requirements, a new bus protocol I3C has emerged. I3C is a new two-wire serial communication technology, which still retains the serial interface structure of two wires (SDA data line and SCL clock line) of a two-wire synchronous serial interface protocol (Inter-Integrated Circuit, referred to as: I2C), integrates and unifies the key features of the serial peripheral interface (Serial Peripheral Interface, referred to as: SPI) and I2C, and realizes optimization in speed, reliability and functionality through a comprehensive scalable interface and architecture.

[0068] Before I3C was introduced, I2C was widely used. However, with the increase in the number of sensor devices, I2C needs to continuously increase the number of general-purpose input / output (GPIO) pins, which makes it impossible to break through the performance bottleneck. The I3C protocol uses an in-band interrupt method, which makes it no longer need a separate interrupt line, reduces the number of pins, and simplifies the system design. The speed of I3C can be as high as 12.5MHz. In addition, I3C is also backward compatible with I2C, so that traditional I2C devices can also be compatible. The I3C bus can support multiple slave devices, and adopts dynamic address allocation technology to ensure that the allocation process is controlled by the host and each device has a unique dynamic address. After the bus is initialized, the device connected to the I3C bus is assigned an address. Devices can be added or changed at any time without redesigning the hardware, which helps to avoid address conflicts and make communication between devices more reliable. The general command code of I3C also has many advantages. It is used to communicate between the I3C host and all slaves, including commands that can configure the host and bus operations for dynamic addressing. In addition, I3C also has rich features such as multi-host support and hot plugging.

[0069] Therefore, I3C is widely used at present. In the related art, the master device communicates with the slave device through the I3C bus to realize data writing and reading. Among them, the I3C bus protocol processes the commands according to the order of the commands sent by the master device to the I3C bus, and realizes writing the data sent by the master device to the slave device or reading the data of the slave device and feeding it back to the master device.

[0070] However, in some special application scenarios, some devices have the characteristics of emergency and real-time transmission. For example, if there are still several commands that have not been executed before an emergency command, then this emergency command may need to wait for a long time, which may be unacceptable for some very urgent scenarios. In other words, if the command sent by the master device is an emergency command, if the command is processed according to the order in which the command is sent, the emergency command may not be processed in time, reducing the security of the system.

[0071] An embodiment of the present invention provides a command processing method. When the command identifier of the pending command indicates that the pending command is an urgent command, the pending command is saved as an urgent command in a priority command queue. When the priority command queue is not empty and the master device is not processing the pending command, the first pending command in the priority command queue is obtained, the first pending command is parsed to obtain first pending command information, a target slave device is determined based on the first pending command information, and a corresponding operation is performed on the target slave device to obtain feedback information sent by the target slave device so as to give priority to the processing of urgent commands and ensure the security of the system.

[0072] According to an embodiment of the present invention, a command processing method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0073] In this embodiment, a command processing method is provided, which is applied to a master device. Figure 1 is a flowchart of a command processing method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0074] Step S101, obtaining commands to be processed.

[0075] The command to be processed includes a command identifier, which is used to indicate whether the command to be processed is an urgent command or a common command, wherein a common command is a non-urgent command.

[0076] The master device can generate pending commands internally according to its own logic and functional requirements, or receive input from the outside through the Advanced High-performance Bus (AHB), such as a user interface, sensor, or other device, to obtain pending commands.

[0077] Figure 2 FIG. 1 is a schematic diagram of the structure of a command processing system according to an embodiment of the present invention. Figure 2 As shown, the command processing system includes a master device and multiple slave devices, wherein the master device and the multiple slave devices communicate via an I3C bus. The master device is a device that controls and initiates communication, and the slave device is a device that responds to requests from the master device.

[0078] The master device includes a command controller, and the master device sends the acquired commands to be processed to the command controller via the AHB bus.

[0079] Step S102: When the command identifier indicates that the command to be processed is an urgent command, the command to be processed is saved as an urgent command in a priority command queue.

[0080] Among them, Figure 2 As shown, the command controller includes a data cache module and a command decoder. The data cache module includes a priority command queue, a common command queue, a priority data queue and a common data queue, which are used to cache the acquired pending commands and the data corresponding to the pending commands. The data queue includes a priority data queue and a common data queue, which are used to cache the data corresponding to the pending commands. The command queue includes priority command correspondence and common command correspondence, which are used to cache the pending commands.

[0081] The command decoder is used to receive pending commands and determine whether the pending command is an urgent command based on the command identifier of the pending command. If the pending command is an urgent command, the urgent command is cached in the priority command queue in the data cache module according to the priority command queue address pre-configured in the command decoder.

[0082] Step S103: monitor the priority command queue in real time.

[0083] The command controller monitors the priority command queue in the data cache module in real time.

[0084] Step S104: when the priority command queue is not empty and the master device is not processing a pending command, obtain the first pending command in the priority command queue.

[0085] Wherein, when the command controller detects that the priority command queue is not empty and the master device is not processing pending commands, the command controller obtains the first pending command in the priority command queue from the data cache module. Wherein, the master device is not processing pending commands actually means that the command controller is not processing pending commands. It can be understood that pending commands can be ordinary commands and emergency commands. When the priority command queue is not empty and the command controller is not processing ordinary commands and emergency commands, the first pending command in the priority command queue is obtained from the data cache module.

[0086] It should be noted that the first command to be executed is an urgent command to be executed in the priority command queue. The command controller processes the commands to be processed through a finite state machine (Finite State Machine, FSM for short).

[0087] Step S105: parse the first command to be executed to obtain first command information to be executed.

[0088] The command decoder parses the first command to be executed to obtain the first command information to be executed.

[0089] Exemplarily, the first to-be-executed command information may include:

[0090] (1) Single Data Rate (SDR) mode: used to distinguish whether the first command to be executed is in SDR mode or High Data Rate (HDR) mode.

[0091] (2) Common Command Code (CCC) command: used to distinguish whether the first command to be executed is a CCC command.

[0092] (3) Broadcast CCC command: Distinguish between broadcast CCC and direct CCC (if it is a non-CCC command, this item is ignored).

[0093] (4) Slave device address: the destination address of the first command to be executed (if it is a broadcast CCC, this item is ignored).

[0094] (5) Data length corresponding to the priority command: indicates the data length of the first command to be executed, which should generally be defined as the maximum length supported for a data transmission.

[0095] (6) Command ID: Each command has a specific ID number, which is used to distinguish commands.

[0096] (7) Read / write signal: distinguish whether the command is a read command or a write command.

[0097] (8) CCC command code: The CCC code corresponding to the command (ignored if it is a private transmission).

[0098] Step S106: determine the target slave device based on the first command information to be executed, and perform a corresponding operation on the target slave device to obtain feedback information sent by the target slave device.

[0099] The master device and the target slave device communicate via the bus.

[0100] After obtaining the first command information to be executed, the command controller determines the target slave device based on the first command information to be executed, and performs a corresponding operation on the target slave device to obtain feedback information sent by the target slave device.

[0101] The master device and the target slave device communicate via the I3C bus.

[0102] The command processing method provided in this embodiment obtains the pending command, and when it is determined that the pending command is an urgent command according to the command identifier in the pending command, the pending command is saved as an urgent command in the priority command queue, and the priority command queue is monitored in real time. When the priority command queue is not empty and the master device is not processing the pending command, the first pending command in the priority command queue is obtained, the first pending command is parsed, the first pending command information is obtained, the target slave device is determined based on the first pending command information, and the corresponding operation is performed on the target slave device to obtain the feedback information sent by the target slave device. By saving the urgent command to the priority command queue, when the priority command queue is not empty and the master device is not processing the pending command, the urgent command in the priority command queue is processed, thereby achieving the effect of timely priority processing of urgent commands and ensuring system security.

[0103] In application scenarios, some sensors need to read data regularly and perform some interrupt processing. This priority processing method can ensure that emergency commands are executed first.

[0104] In this embodiment, a command processing method is provided, which is applied to a master device. Figure 3 is a flowchart of a command processing method according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:

[0105] Step S301, obtaining commands to be processed.

[0106] The pending command includes the command identifier. For details, see Figure 1 Step S101 of the illustrated embodiment will not be described in detail here.

[0107] Step S302: When the command identifier indicates that the command to be processed is an urgent command, the command to be processed is saved as an urgent command in a priority command queue.

[0108] For details, please see Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.

[0109] Step S303: monitor the priority command queue in real time.

[0110] For details, please see Figure 1 Step S103 of the illustrated embodiment will not be described in detail here.

[0111] Step S304: when the priority command queue is not empty and the master device is not processing a pending command, obtain the first pending command in the priority command queue.

[0112] For details, please see Figure 1 Step S104 of the illustrated embodiment will not be described in detail here.

[0113] Step S305: parse the first command to be executed to obtain first command information to be executed.

[0114] For details, please see Figure 1 Step S105 of the illustrated embodiment will not be described in detail here.

[0115] Step S306, determining the target slave device based on the first command information to be executed, and performing corresponding operations on the target slave device to obtain feedback information sent by the target slave device, and the master device and the target slave device communicate through the bus.

[0116] For details, please see Figure 1 Step S106 of the illustrated embodiment will not be described in detail here.

[0117] Step S307, when the priority command queue is not empty and the master device is processing a pending command, after the master device completes processing the pending command being processed, obtain the first pending command in the priority command queue, parse the first pending command, obtain the first pending command information, determine the target slave device based on the first pending command information, perform corresponding operations on the target slave device, and obtain feedback information.

[0118] It can be understood that the pending commands can be ordinary commands and emergency commands. When the command controller detects that the priority command queue is not empty and the master device is processing an ordinary command or an emergency command, and when the master device has processed the ordinary command or emergency command being processed, it executes the steps of obtaining the first pending command in the priority command queue, parsing the first pending command, obtaining the first pending command information, determining the target slave device based on the first pending command information, performing corresponding operations on the target slave device, and obtaining feedback information.

[0119] Figure 4 is a timing diagram for processing emergency commands in the related art. Figure 4 As shown, the execution order of ordinary commands in the ordinary command queue is cmd0, cmd1, ..., cmdn, where data0, data1, data2 are the data corresponding to cmd0, data3, data4, data5 are the data corresponding to cmd1, data6, etc. are the data corresponding to cmd2, and data_p1 is the data corresponding to cmd_p. If an emergency command cmd_p is requested for processing during the execution of the ordinary command cmd1, the processing method of the related technology is to wait for the master device to execute all commands before the emergency command cmd_p before processing the emergency command cmd_p. In other words, the time to process the emergency command cmd_p depends on the number of commands that the master device needs to process before the emergency command cmd_p.

[0120] Figure 5 FIG. 1 is a timing diagram of an embodiment of the present invention for processing an emergency command. Figure 5As shown, the execution order of ordinary commands in the ordinary command queue is cmd0, cmd1, ..., cmdn, where data0, data1, data2 are the data corresponding to cmd0, data3, data4, data5 are the data corresponding to cmd1, data_p1, data_p2 are the data corresponding to cmd_p, etc. If an emergency command cmd_p is applied for processing during the execution of the ordinary command cmd1, the processing method of this application is to wait for the main device to execute the ordinary command cmd1, and then process the emergency command cmd_p. In other words, the time to process the emergency command cmd_p is the time it takes for the main device to complete processing the ordinary command cmd1. It can be seen that the way this embodiment processes emergency commands saves the waiting time for emergency commands.

[0121] Step S308: When the command identifier indicates that the command to be processed is a common command, the command to be processed is saved as a common command in a common command queue.

[0122] Among them, the command decoder is used to receive pending commands, determine whether the pending command is an urgent command based on the command identifier of the pending command, and if the pending command is an ordinary command, cache the ordinary command into the ordinary command queue in the data cache module according to the ordinary command queue address pre-configured in the command decoder.

[0123] Step S309: monitor the common command queue in real time.

[0124] The command controller monitors the common command queue in the data cache module in real time.

[0125] Step S310: when the priority command queue is empty and the common command queue is not empty, obtain the second to-be-executed command in the common command queue.

[0126] When the command controller detects that the priority command queue is empty and the normal command queue is not empty, it obtains the second to-be-executed command in the normal command queue from the data cache module. In other words, the normal command queue will not be executed until all the urgent commands in the priority command queue are processed. When the command controller is processing a normal command, if the command controller detects that the priority command is not empty, it will immediately start executing the urgent command in the priority command queue after the normal command currently being processed is completed.

[0127] It should be noted that the second command to be executed is a common command to be executed in the common command queue.

[0128] Step S311, parsing the second command to be executed to obtain information of the second command to be executed.

[0129] The command decoder parses the second command to be executed to obtain second command information to be executed. The second command information to be executed is similar to the first command information to be executed, and will not be described in detail here.

[0130] Step S312: determine the target slave device based on the second command information to be executed, and perform a corresponding operation on the target slave device to obtain feedback information.

[0131] After obtaining the second command information to be executed, the command controller determines the target slave device based on the second command information to be executed, and performs a corresponding operation on the target slave device to obtain feedback information sent by the target slave device.

[0132] The command processing method provided in this embodiment processes the urgent commands in the priority command queue after the priority command queue is not empty and the master device has processed the pending commands being processed, thereby achieving the effect of timely and preferentially processing the urgent commands and ensuring the security of the system.

[0133] When the priority command queue is empty and the common command queue is not empty, the second command to be executed in the common command queue is obtained, the second command to be executed is parsed, the second command to be executed information is obtained, the target slave device is determined based on the second command to be executed information, and the corresponding operation is performed on the target slave device to obtain feedback information. When the priority command queue is empty, the common commands in the common command queue are processed, thereby achieving the effect of giving priority to urgent commands.

[0134] In some optional implementations, the command processing method further includes:

[0135] Step a1: when the command to be processed is an urgent command and the command type of the command to be processed is a read command, the obtained feedback information is cached in a priority data queue as data corresponding to the command to be processed.

[0136] in, Figure 6 Schematic diagram of a priority command queue and a priority data queue in a data cache module according to an embodiment of the present invention. Figure 6 As shown, urgent commands in the priority command queue, such as pcmd0, etc., correspond to data in the priority data queue. For example, pcmd0 corresponds to pdata0 and pdata1 in the priority data queue.

[0137] It should be noted that the priority command queue serves as a control unit and the priority data queue serves as a data unit.

[0138] When the pending command is an urgent command and the command type of the pending command is a read command, the command controller receives the pending command, processes the pending command, obtains feedback information sent by the target slave device, that is, the data read from the target slave device, and caches the data read from the target slave device as the data corresponding to the pending command to the priority data queue in the data cache module.

[0139] The command decoder caches the data corresponding to the command to be processed into the priority data queue in the data cache module according to the priority data queue address pre-configured in the command decoder.

[0140] Step a2: when the command to be processed is an urgent command and the command type of the command to be processed is a write command, data corresponding to the command to be processed is obtained, and the data corresponding to the command to be processed is cached in a priority data queue.

[0141] When the pending command is an urgent command and the command type of the pending command is a write command, the master device receives the pending command and the corresponding data of the pending command, that is, the data pre-written into the target slave device, and sends the acquired data corresponding to the pending command to the command controller. The command decoder in the command controller caches the data corresponding to the pending command into the priority data queue in the data cache module according to the priority data queue address pre-configured in the command decoder.

[0142] Step a3: when the command to be processed is a common command and the command type of the command to be processed is a read command, the obtained feedback information is cached in a common data queue as data corresponding to the command to be processed.

[0143] Figure 7 FIG. 1 is a schematic diagram of a common command queue and a common data queue in a data cache module according to an embodiment of the present invention. Figure 7 As shown, there is a corresponding relationship between the common commands in the common command queue, such as cmd0, cmd1, cmd2, cmd3, ..., cmdn, and the data in the common data queue. For example, cmd0 corresponds to data0, data1, and data2 in the common data queue. cmd1 corresponds to data3, data4, and data5 in the common data queue. cmd2 corresponds to data6 and data7 in the common data queue.

[0144] It should be noted that the ordinary command queue serves as a control unit, and the ordinary data queue serves as a data unit.

[0145] When the pending command is a normal command and the command type of the pending command is a read command, the command controller receives the pending command, processes the pending command, obtains feedback information sent by the target slave device, that is, the data read from the target slave device, and caches the data read from the target slave device as the data corresponding to the pending command to the normal data queue in the data cache module.

[0146] The command decoder caches the data corresponding to the command to be processed into the common data queue in the data cache module according to the common data queue address pre-configured in the command decoder.

[0147] Step a4: when the command to be processed is a common command and the command type of the command to be processed is a write command, data corresponding to the command to be processed is obtained, and the data corresponding to the command to be processed is cached in a common data queue.

[0148] When the pending command is an urgent command and the command type of the pending command is a write command, the master device receives the pending command and the corresponding data of the pending command, that is, the data pre-written into the target slave device, and sends the acquired data corresponding to the pending command to the command controller. The command decoder in the command controller caches the data corresponding to the pending command into the ordinary data queue in the data cache module according to the ordinary data queue address pre-configured in the command decoder.

[0149] The command processing method provided in this embodiment achieves orderly storage and efficient processing of data by caching the data corresponding to the command in the corresponding data queue, thereby improving the overall efficiency and response speed of the system.

[0150] In some optional implementations, the above step S306 includes:

[0151] Step b1, when the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is broadcast transmission, send a broadcast header and wait for the target slave device to respond. When the target slave device responds, send the command code corresponding to the first command to be executed and the data corresponding to the first command to be executed to the target slave device, so that the target slave device executes the write operation of the data corresponding to the first command to be executed based on the command code, and sends the write completion information to the master device as feedback information.

[0152] The first command information to be executed includes the command type of the first command to be executed, the command transmission mode of the first command to be executed, and the command code corresponding to the first command to be executed. It should be noted that the command type of the first command to be executed is determined by the information corresponding to the read / write signal in the first command information to be executed, the command transmission mode of the first command to be executed is determined by the information corresponding to the broadcast CCC command in the first command information to be executed, and the command code corresponding to the first command to be executed is determined by the information corresponding to the CCC command code in the first command to be executed.

[0153] Figure 8 is a structural diagram of processing a write command according to an embodiment of the present invention. Figure 8 As shown, the command controller writes the pending command and the data corresponding to the pending command into the corresponding command queue buffer and data queue buffer through the AHB bus, wherein the pending command can be a common command or a priority command. The command parser in the command controller parses the command according to the common command queue address, the priority command queue address, the common data queue address and the priority queue data address to obtain the command information and the data corresponding to the command.

[0154] The command controller determines whether the priority command queue is empty. If the priority command queue is not empty, the state machine controls the command to be processed to be the first command to be executed in the priority command queue. If the priority command queue is empty, the state machine controls the command to be processed to be the second command to be executed.

[0155] If the selected command is the first command to be executed, the command controller obtains the selected first command to be executed, and obtains the data cache corresponding to the first command to be executed through the control signal. A multiplexer (Multiplex, abbreviated as: MUX) is used to merge multiple data sources corresponding to the first command to be executed into a single data stream, that is, the data corresponding to the first command to be executed, and the data corresponding to the first command to be executed is sent to the command controller through the sending data cache module to complete the write data transmission.

[0156] The command controller can obtain the command transmission mode (whether it is a broadcast CCC command), command ID number, slave device address and other information of the first command to be executed based on the first command information to be executed, and convert the first command information to be executed and the data corresponding to the first command to be executed into a data format adapted to the I3C bus under the action of the transmission control module.

[0157] If the command type of the first command to be executed is a write command, and the command transmission mode of the first command to be executed is broadcast transmission, that is, broadcast CCC write transmission, then after sending the broadcast header 7'h7E and waiting for the target slave device to respond, that is, the responding device is the target slave device, the command code corresponding to the first command to be executed, that is, the broadcast CCC command code and the data corresponding to the first command to be executed are sent to the target slave device, so that the target slave device executes the write operation of the data corresponding to the first command to be executed based on the command code, and sends the write completion information to the master device as feedback information.

[0158] It should be noted that the target slave device responds, and the transmission control module obtains the response information of the target slave device, wherein the response information of the target slave device is write response data, and the response information of the target slave device is written into the response command controller through the control signal to realize the write response. The response command controller includes a response command queue, which is used to store the write command and the response information of the target slave device corresponding to the write command. Exemplarily, the write command is rcmd0, rcmd1, ..., rcmdn, and the response information of the target slave device corresponding to the write command is rdata0, rdata1, ..., rdatan.

[0159] It is further necessary to explain that Fig. 9 1 is a schematic diagram of data transmission according to an I3C protocol write command according to an embodiment of the present invention. Fig. 9 As shown, when the master device sends data to the target slave device, the data needs to be converted into a format that adapts to the I3C bus. That is, when the master device sends data to the target slave device, it needs to follow the following Fig. 9 The data transmission method shown is used for transmission. Among them, S (start) is the start bit, indicating that data transmission is about to start, and 7'h7E is the broadcast header. Rnw (read / write) is the read / write flag bit, 0 indicates a write operation, and 1 indicates a read operation. ACK (Acknowledgement) is the response bit, indicating whether the receiver responds (corresponding to NACK: no response). CCC is a command code used to execute a specific control command. T is a parity bit. Writedata represents the actual data to be sent, and in this embodiment, it is the data to be written to the target slave device, that is, the data corresponding to the first command to be executed. Sr means restarting the transmission, and STOP means stopping the transmission.

[0160] Step b2, when the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is direct transmission, send a broadcast header and wait for the slave device to respond. When the slave device responds, send the command code and the target slave device address corresponding to the first command to be executed to match the target slave device based on the target slave device address. When the target slave device responds, send the data corresponding to the first command to be executed to the target slave device, so that the target slave device executes the write operation of the data corresponding to the first command to be executed, and send the write completion information as feedback information to the master device.

[0161] If the command type of the first command to be executed is a write command, and the command transmission mode of the first command to be executed is direct transmission, that is, direct CCC write transmission, then after sending the broadcast header 7'h7E and waiting for the slave device to respond, send the direct CCC command, that is, the command code corresponding to the first command to be executed, and then send the target slave device address to match the target slave device based on the target slave device address. When the target slave device responds, send the data corresponding to the first command to be executed to the target slave device.

[0162] Step b3, when the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is private transmission, send a broadcast header and a target slave device address to match the target slave device based on the target slave device address, and when the target slave device responds, send the data corresponding to the first command to be executed to the target slave device, so that the target slave device executes the write operation of the data corresponding to the first command to be executed, and send the write completion information to the master device as feedback information.

[0163] If the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is private transmission, a broadcast header 7'h7E and a target slave device address are sent to match the target slave device based on the target slave device address. When the target slave device responds, data corresponding to the first command to be executed is sent to the target slave device.

[0164] The command processing method provided in this embodiment supports command transmission modes including broadcast CCC write transmission, direct CCC write transmission and private write transmission, and is widely used. This embodiment implements mixed interrupt transmission of priority command queues for broadcast CCC, direct CCC, and private transmission. The priority command queue in this embodiment has a higher priority than the ordinary command queue, and supports interrupting commands of any command transmission mode being executed. After the priority command queue is executed, ordinary commands can still continue to be transmitted. In some special application scenarios, the present invention can also be expanded into multi-level priority command queues by superposition to achieve specific functions.

[0165] In some optional implementations, the above step S306 includes:

[0166] Step c1, when the command type of the first command to be executed is a read command and the command transmission mode of the first command to be executed is direct transmission, send a broadcast header and wait for a response from the slave device. When the slave device responds, send a command code and a target slave device address corresponding to the first command to be executed to match the target slave device based on the target slave device address. When the target slave device responds, read the data of the target slave device based on the data length corresponding to the first command to be executed, wherein the read data is feedback information.

[0167] Among them, the read command is written into the corresponding command queue cache through the AHB bus, the command controller parses the read command, and determines whether the priority command queue is empty. If the priority command queue is not empty, the command to be processed is selected as the first command to be executed in the priority command queue through the state machine control. If the priority command queue is empty, the command to be processed is selected as the second command to be executed through the state machine control.

[0168] If the selected command is the first command to be executed, the command type of the first command to be executed is a read command, and the command transmission mode of the first command to be executed is direct transmission, that is, direct CCC read transmission, then after sending the broadcast header 7'h7E and waiting for the slave device to respond, the command code (direct CCC command code) and the target slave device address corresponding to the first command to be executed are sent to match the target slave device based on the target slave device address, and when the target slave device responds, the data of the target slave device is read based on the data length corresponding to the first command to be executed, wherein the read data is feedback information. The command controller writes the feedback information into the corresponding data queue cache as the data corresponding to the first command to be executed.

[0169] The first command information to be executed also includes the data length corresponding to the first command to be executed, which corresponds to the data length corresponding to the priority command in the first command information to be executed, that is, the data length pre-read from the target slave device.

[0170] Step c2, when the command type of the first command to be executed is a read command and the command transmission mode of the first command to be executed is private transmission, send a broadcast header and a target slave device address to match the target slave device based on the target slave device address, and when the target slave device responds, read the data of the target slave device based on the data length corresponding to the first command to be executed.

[0171] If the command type of the first command to be executed is a read command, and the command transmission mode of the first command to be executed is private transmission, then the broadcast header 7'h7E and the target slave device address are sent to match the target slave device based on the target slave device address. When the target slave device responds, data is read from the target slave device according to the data length corresponding to the first command to be executed.

[0172] The command processing method provided in this embodiment supports command transmission modes including direct CCC read transmission and private read transmission, and is widely used.

[0173] In some optional implementations, the command processing method further includes:

[0174] Step d1, when the master device sends data to the target slave device through the bus, the data is converted into data in a format adapted to the bus.

[0175] The command processing system also includes a transmission control module and a response command controller. The transmission control module is used to convert the data sent by the master device to the target slave device into data in the form of an I3C bus adaptation, and then send the data in the form of an I3C bus adaptation to the target slave device via the I3C bus.

[0176] The transmission control module is also used to convert the feedback information sent by the target slave device into data in a form adapted to the AHB bus for transmission to the command controller.

[0177] It should be noted that the transmission control module is also used to obtain the abnormal information of the master device and the abnormal response status information of the slave device, and send the abnormal information of the master device and the abnormal response status information of the slave device to the response command controller. Among them, the abnormal response status information of the slave device is the abnormal status information such as negative acknowledgment (Negative Acknowledgement, referred to as: NACK) in the response of the slave device.

[0178] Specifically, the transmission control module monitors the length of the data sent to the target slave device and the length of the data obtained from the target slave device in real time, and monitors the response signal of the slave device. It can be understood that if the length of the data sent to the target slave device is different from the data length corresponding to the command to be processed, it is determined that an abnormality has occurred in the master device. If the length of the data obtained from the target slave device is different from the data length corresponding to the command to be processed, it is determined that an abnormality has occurred in the slave device. If an abnormality occurs in the response signal of the slave device, it is determined that the slave device sends an abnormal response. The transmission control module transmits the above-mentioned abnormal information of the master device and the abnormal response status information of the slave device to the response command controller, and the response command controller caches the received information.

[0179] When an error occurs during the transmission of a write command from the master device, the slave device initiates an interrupt. At this time, the master device can view the specific error type from the response command controller and handle it.

[0180] The response command controller is used to receive the abnormal information of the master device and the abnormal response status information of the slave device, and cache data according to different abnormal information. When the master device has an abnormality and needs to be retransmitted, the corresponding abnormal information can be viewed in the response command controller.

[0181] The response command controller includes a verification module and a response command queue. The response command queue is used to cache the abnormal information of the master device and the abnormal response status information of the slave device, and is also used to cache the response information of the target slave device. The verification module is used to verify the data in the response command queue to verify the integrity and correctness of the data.

[0182] In some optional implementations, the command processing method further includes:

[0183] When the master device sends data to the target slave device through the bus, the working mode of the bus is determined by the data type of the data, and the bus is adjusted to perform data transmission according to the working mode.

[0184] The command processing system also includes an SDA / SCL control module, which may include an SCL controller and an SDA controller, wherein the SCL controller is used to generate an enable signal and a control output signal for the SCL clock line, and the SDA controller is used to generate an enable signal and a control output signal for the SDA data line, thereby determining the open-drain mode, push-pull mode, I3C start signal, repeated start signal, stop condition, T bit generation, start and exit of HDR mode, etc. of the I3C bus.

[0185] The SDA / SCL control module is also used to control the rate of I3C data transmission. Based on the system clock, the SCL divider value is generated in open-drain mode and push-pull mode according to the I2C slave device and I3C slave device that support different rates, thereby controlling the rate of I3C data transmission.

[0186] It should be noted that the SDA / SCL control module determines the I3C data transmission rate according to the SDR mode in the first command information to be executed or the second command information to be executed.

[0187] It should be further explained that the processing of the second command to be executed is similar to the processing of the first command to be executed, and will not be repeated here.

[0188] In some optional implementations, the command processing method further includes:

[0189] The usage of the command queue is monitored in real time, wherein the command queue includes a priority command queue and a common command queue.

[0190] When the usage of the command queue is that the number of commands contained in the command queue exceeds a first preset threshold, the storage space of the command queue is automatically expanded to avoid queue overflow and data loss.

[0191] The first preset threshold is set by a technician. If the number of commands in the command queue exceeds the first preset threshold, it indicates that the command queue contains a large number of commands, which will exceed the storage space of the command queue. In this case, the storage space of the command queue needs to be expanded.

[0192] When the usage of the command queue is that the number of commands contained in the command queue is less than a second preset threshold, the storage space of the command queue is reduced to save memory resources.

[0193] The second preset threshold is set by a technician. If the number of commands in the command queue is less than the second preset threshold, it indicates that the number of commands in the command queue is small, thereby reducing the storage space of the command queue and saving memory resources.

[0194] The command processing method provided in this embodiment realizes effective management of the command queue.

[0195] In some optional implementations, the command processing method further includes:

[0196] When the command identifier indicates that the command to be processed is an urgent command of the first priority, the command to be processed is saved in the priority command queue as an urgent command of the first priority.

[0197] When the command identifier indicates that the command to be processed is an urgent command of the second priority, the command to be processed is saved in the priority command queue as an urgent command of the second priority.

[0198] When the command identifier indicates that the command to be processed is an urgent command of the third priority, the command to be processed is saved in the priority command queue as an urgent command of the third priority.

[0199] The first priority is higher than the second priority, and the second priority is higher than the third priority. The corresponding emergency commands are arranged in the priority command queue in order from high to low priority. It can be understood that the emergency commands in the priority command queue are executed in order from high to low priority.

[0200] The command processing method provided in this embodiment improves the responsiveness and processing efficiency of the system by flexibly processing emergency commands according to their priorities.

[0201] In some optional implementations, the command processing method of the embodiment of the present invention is still applicable to the I2C protocol. Fig.10 1 is a schematic diagram of data transmission according to an I2C protocol write command according to an embodiment of the present invention. Fig.10 As shown, it includes a start signal (S), a slave address (Slave address), where Rnw=0 indicates a write operation, a response bit (ACK), data (DATA) is the data to be written to the target slave device, a stop bit (P), etc. The response bit is used when the master device sends a byte of data, and the slave device will pull down the data line in the next clock cycle as a response.

[0202] Assuming that there is an urgent command to be processed in the I2C protocol, and the urgent command is a write command, the command processing method of the embodiment of the present invention is used to perform command processing as follows:

[0203] First, ordinary commands and corresponding data, emergency commands and corresponding data are cached separately.

[0204] The command controller determines whether the priority command queue is empty.

[0205] If the priority command queue is not empty, the address of the urgent command to be executed in the priority command queue will be sent first through the control of the state machine, and after waiting for the response from the slave device, the data corresponding to the urgent command will continue to be sent to the transmission control module, and the data will be converted into data adapted to the I2C protocol, and the data adapted to the I2C protocol will be sent to the I2C bus. According to the I2C protocol, each byte must be responded to by the slave device after it is sent, and the data corresponding to the urgent command will be sent accordingly.

[0206] If the priority command queue is empty, the ordinary command is sent and processed according to the I2C protocol format in the same way as the emergency command.

[0207] The I2C master sends a stop signal and the write command transmission ends.

[0208] The command processing method provided in this embodiment is also compatible with the I2C protocol, and can use the hardware system solution of the priority command queue to implement the data format of the I2C bus adaptation read and write transmission, thereby realizing priority processing of urgent commands on the I2C bus.

[0209] In this embodiment, a command processing method is also provided. Fig.11 FIG. 1 is a flowchart of a command processing method according to an embodiment of the present invention. Fig.11As shown, the parsing command is to parse the command to be processed and obtain the command information of the command to be processed. The command processing system determines whether to start the priority processing of urgent commands by turning the priority enable on and off. When the priority enable is turned on, it is determined to use the command processing method of the embodiment of the present invention to process the command. Priority enable on means that the priority enable is turned on. When the priority enable is turned on, it is determined whether the priority queue is not empty, that is, whether the priority command queue is not empty. When the priority command queue is not empty, the priority queue command is executed, that is, the urgent command in the priority command queue is processed. When the priority command queue is empty, the ordinary queue command is executed, that is, the ordinary command in the ordinary command queue is processed.

[0210] When processing an emergency command in the priority command queue, determine whether the emergency command is a broadcast CCC command based on the command information of the emergency command. If the emergency command is a broadcast CCC command, that is, the command transmission mode of the emergency command is broadcast transmission, then send (receive) the data corresponding to the emergency command, where the priority queue data is the data corresponding to the emergency command. After sending (receiving) the data corresponding to the emergency command, send (receive) the end mark and prepare for the next command.

[0211] When the emergency command is not a broadcast CCC command, the command transmission mode of the emergency command can be direct transmission or private transmission. Both methods require waiting for the target slave device to respond, sending (receiving) the data corresponding to the emergency command, and after sending (receiving) the data corresponding to the emergency command, sending (receiving) the end mark and preparing for the next command.

[0212] When processing a common command in a common command queue, i.e., executing a common command, it is determined whether the common command is a broadcast CCC command based on the command information of the common command. If the common command is a broadcast CCC command, i.e., the command transmission mode of the common command is broadcast transmission, then the data corresponding to the common command is sent (received), wherein the common queue data is the data corresponding to the common command. After sending (receiving) the data corresponding to the common command, an end flag is sent (received) and the next command is prepared.

[0213] When the ordinary command is not a broadcast CCC command, the command transmission mode of the ordinary command can be direct transmission or private transmission. Both methods require waiting for the target slave device to respond, sending (receiving) the data corresponding to the ordinary command, and after sending (receiving) the data corresponding to the ordinary command, sending (receiving) the end mark and preparing for the next command.

[0214] The command processing method provided in this embodiment sets the emergency command as the priority command, and can transmit the priority command queue on the I3C bus by interrupting the ordinary command. This method will greatly shorten the waiting time for the emergency command application, and after the emergency command and the corresponding data transmission are completed, the ordinary command queue can continue to be transmitted. In addition, the emergency command supports a wide range of applications, including the broadcast CCC write command, direct CCC read and write command, and private command read and write transmission of the I3C protocol.

[0215] In the present embodiment, a command processing device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0216] This embodiment provides a command processing device, such as Fig.12 As shown, including:

[0217] The first acquisition module 1201 is used to acquire a command to be processed, where the command to be processed includes a command identifier.

[0218] The first saving module 1202 is configured to save the to-be-processed command as an urgent command to a priority command queue when the command identifier indicates that the to-be-processed command is an urgent command.

[0219] The first monitoring module 1203 is used to monitor the priority command queue in real time.

[0220] The second acquisition module 1204 is configured to acquire the first to-be-executed command in the priority command queue when the priority command queue is not empty and the master device is not processing a to-be-processed command.

[0221] The first parsing module 1205 is used to parse the first command to be executed to obtain first command information to be executed.

[0222] The first determination module 1206 is used to determine the target slave device based on the first command information to be executed, and perform corresponding operations on the target slave device to obtain feedback information sent by the target slave device. The master device and the target slave device communicate through a bus.

[0223] In some optional implementations, the command processing device further includes:

[0224] The third acquisition module is used to obtain the first command to be executed in the priority command queue, parse the first command to be executed, obtain the first command information to be executed, determine the target slave device based on the first command information to be executed, perform corresponding operations on the target slave device, and obtain feedback information after the master device completes processing the command to be executed.

[0225] In some optional implementations, the command processing device further includes:

[0226] The second saving module is used for saving the to-be-processed command as a common command into a common command queue when the command identifier indicates that the to-be-processed command is a common command.

[0227] The second monitoring module is used to monitor the common command queue in real time.

[0228] The fourth acquisition module is used to acquire the second to-be-executed command in the common command queue when the priority command queue is empty and the common command queue is not empty.

[0229] The second parsing module is used to parse the second command to be executed to obtain the second command information to be executed.

[0230] The second determination module is used to determine the target slave device based on the second command information to be executed, and perform a corresponding operation on the target slave device to obtain feedback information.

[0231] In some optional implementations, the command processing device further includes:

[0232] The first cache unit is used to cache the obtained feedback information as data corresponding to the command to be processed into the priority data queue when the command to be processed is an urgent command and the command type of the command to be processed is a read command.

[0233] The second cache unit is used to obtain data corresponding to the command to be processed when the command to be processed is an urgent command and the command type of the command to be processed is a write command, and cache the data corresponding to the command to be processed into a priority data queue.

[0234] The third cache unit is used to cache the obtained feedback information as data corresponding to the command to be processed into the common data queue when the command to be processed is a common command and the command type of the command to be processed is a read command.

[0235] The fourth cache unit is used to obtain data corresponding to the command to be processed when the command to be processed is a common command and the command type of the command to be processed is a write command, and cache the data corresponding to the command to be processed into the common data queue.

[0236] In some optional implementations, the first determining module 1206 includes:

[0237] The first sending unit is used to send a broadcast header and wait for a response from a target slave device when the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is broadcast transmission; when the target slave device responds, send a command code corresponding to the first command to be executed and data corresponding to the first command to be executed to the target slave device, so that the target slave device executes a write operation of the data corresponding to the first command to be executed based on the command code, and sends write completion information as feedback information to the master device.

[0238] The second sending unit is used to send a broadcast header and wait for a response from the slave device when the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is direct transmission; when the slave device responds, send the command code and the target slave device address corresponding to the first command to be executed to match the target slave device based on the target slave device address; when the target slave device responds, send the data corresponding to the first command to be executed to the target slave device so that the target slave device executes a write operation of the data corresponding to the first command to be executed, and send the write completion information as feedback information to the master device.

[0239] The third sending unit is used to send a broadcast header and a target slave device address when the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is private transmission, so as to match the target slave device based on the target slave device address, and when the target slave device responds, send the data corresponding to the first command to be executed to the target slave device, so that the target slave device executes the write operation of the data corresponding to the first command to be executed, and sends the write completion information as feedback information to the master device.

[0240] In some optional implementations, the first determining module 1206 includes:

[0241] The fourth sending unit is used to send a broadcast header and wait for a response from the slave device when the command type of the first command to be executed is a read command and the command transmission mode of the first command to be executed is direct transmission; when the slave device responds, send the command code and the target slave device address corresponding to the first command to be executed to match the target slave device based on the target slave device address; when the target slave device responds, read the data of the target slave device based on the data length corresponding to the first command to be executed, wherein the read data is feedback information.

[0242] The fifth sending unit is used to send a broadcast header and a target slave device address when the command type of the first command to be executed is a read command and the command transmission mode of the first command to be executed is private transmission, so as to match the target slave device based on the target slave device address, and read the data of the target slave device based on the data length corresponding to the first command to be executed when the target slave device responds.

[0243] In some optional implementations, the command processing device further includes:

[0244] The conversion module is used to convert the data into data in a bus-adapting form when the master device sends data to the target slave device through the bus.

[0245] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0246] The command processing device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0247] The embodiment of the present invention also provides a computer device having the above Fig.12 The command processing device shown.

[0248] See also Fig.13 , Fig.13 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig.13 As shown, the computer device includes: one or more processors 1301, memory 1302, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other, and can be installed on a common mainboard or installed in other ways as required. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig.13 A processor 1301 is taken as an example.

[0249] The processor 1301 may be a central processing unit, a network processor or a combination thereof. The processor 1301 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable logic gate array, a general purpose array logic or any combination thereof.

[0250] The memory 1302 stores instructions executable by at least one processor 1301 , so that the at least one processor 1301 executes the method shown in the above embodiment.

[0251] The memory 1302 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 1302 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 1302 may optionally include a memory remotely arranged relative to the processor 1301, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0252] The memory 1302 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 1302 may also include a combination of the above types of memory.

[0253] The computer device also includes a communication interface 1303, which is used for the computer device to communicate with other devices or a communication network.

[0254] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0255] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0256] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A command processing method, characterized in that: Applied to a master device, the method comprises: Obtaining a command to be processed, wherein the command to be processed includes a command identifier; When the command identifier indicates that the pending command is an urgent command, the pending command is saved as an urgent command in a priority command queue; monitoring the priority command queue in real time; When the priority command queue is not empty and the master device is not processing a pending command, obtaining a first pending command in the priority command queue; Parsing the first command to be executed to obtain first command information to be executed; A target slave device is determined based on the first command information to be executed, and a corresponding operation is performed on the target slave device to obtain feedback information sent by the target slave device. The master device and the target slave device communicate through a bus.

2. The method according to claim 1, characterized in that The method further comprises: When the priority command queue is not empty and the master device is processing a pending command, after the master device completes processing the pending command being processed, obtain the first pending command in the priority command queue, parse the first pending command to obtain first pending command information, determine the target slave device based on the first pending command information, perform corresponding operations on the target slave device, and obtain feedback information.

3. The method according to claim 1, characterized in that: The method further comprises: When the command identifier indicates that the command to be processed is a common command, the command to be processed is saved as a common command in a common command queue; Monitoring the common command queue in real time; When the priority command queue is empty and the common command queue is not empty, obtaining a second to-be-executed command in the common command queue; Parsing the second command to be executed to obtain information of the second command to be executed; A target slave device is determined based on the second command information to be executed, and a corresponding operation is performed on the target slave device to obtain feedback information.

4. The method according to claim 3, characterized in that The method further comprises: When the command to be processed is an urgent command and the command type of the command to be processed is a read command, the obtained feedback information is cached in a priority data queue as data corresponding to the command to be processed; When the pending command is an urgent command and the command type of the pending command is a write command, obtaining data corresponding to the pending command and caching the data corresponding to the pending command into a priority data queue; When the command to be processed is a common command and the command type of the command to be processed is a read command, the obtained feedback information is cached in a common data queue as data corresponding to the command to be processed; When the command to be processed is a common command and the command type of the command to be processed is a write command, data corresponding to the command to be processed is acquired, and the data corresponding to the command to be processed is cached in a common data queue.

5. The method according to claim 4, characterized in that The first command information to be executed includes a command type of the first command to be executed, a command transmission mode of the first command to be executed, and a command code corresponding to the first command to be executed, and determining a target slave device based on the first command information to be executed, and performing a corresponding operation on the target slave device to obtain feedback information sent by the target slave device, including: In the case where the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is broadcast transmission, sending a broadcast header and waiting for a response from a target slave device, and in the case where the target slave device responds, sending a command code corresponding to the first command to be executed and data corresponding to the first command to be executed to the target slave device, so that the target slave device executes a write operation of the data corresponding to the first command to be executed based on the command code, and sends write completion information as feedback information to a master device; In a case where the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is direct transmission, sending a broadcast header and waiting for a response from a slave device, and in a case where the slave device responds, sending a command code and a target slave device address corresponding to the first command to be executed to match a target slave device based on the target slave device address, and in a case where the target slave device responds, sending data corresponding to the first command to be executed to the target slave device so that the target slave device executes a write operation of the data corresponding to the first command to be executed, and sending write completion information as feedback information to a master device; When the command type of the first command to be executed is a write command and the command transmission mode of the first command to be executed is private transmission, a broadcast header and a target slave device address are sent to match the target slave device based on the target slave device address. When the target slave device responds, data corresponding to the first command to be executed is sent to the target slave device so that the target slave device executes a write operation on the data corresponding to the first command to be executed, and write completion information is sent to the master device as feedback information.

6. The method according to claim 4, characterized in that The first command information to be executed includes a command type of the first command to be executed, a command transmission mode of the first command to be executed, a command code corresponding to the first command to be executed, and a data length corresponding to the first command to be executed. The determining of a target slave device based on the first command information to be executed and performing a corresponding operation on the target slave device to obtain feedback information sent by the target slave device includes: In a case where the command type of the first command to be executed is a read command and the command transmission mode of the first command to be executed is direct transmission, sending a broadcast header and waiting for a response from a slave device, and in a case where the slave device responds, sending a command code and a target slave device address corresponding to the first command to be executed, so as to match a target slave device based on the target slave device address, and in a case where the target slave device responds, reading data of the target slave device based on a data length corresponding to the first command to be executed, wherein the read data is feedback information; When the command type of the first command to be executed is a read command and the command transmission mode of the first command to be executed is private transmission, a broadcast header and a target slave device address are sent to match the target slave device based on the target slave device address. When the target slave device responds, the data of the target slave device is read based on the data length corresponding to the first command to be executed.

7. The method according to claim 1, characterized in that The method further comprises: When the master device sends data to the target slave device via the bus, the data is converted into data in a format adapted to the bus.

8. A command processing device, characterized in that: The device comprises: A first acquisition module, used for acquiring a command to be processed, wherein the command to be processed includes a command identifier; A first saving module, configured to save the to-be-processed command as an urgent command to a priority command queue when the command identifier indicates that the to-be-processed command is an urgent command; A first monitoring module, used for monitoring the priority command queue in real time; A second acquisition module, configured to acquire a first to-be-executed command in the priority command queue when the priority command queue is not empty and the master device is not processing a to-be-processed command; A first parsing module, used for parsing the first command to be executed to obtain first command information to be executed; The first determination module is used to determine the target slave device based on the first command information to be executed, and perform corresponding operations on the target slave device to obtain feedback information sent by the target slave device. The master device and the target slave device communicate through a bus.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the command processing method according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the command processing method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Master-slave device read operation communication method and communication system

    CN121614432A