Protocol-assisted learning implementation method, device, computer terminal and storage medium
Through a protocol-assisted learning implementation method, command identifier matching and random generation of command parameter values, exemplary target commands are generated, and the command transmission process is demonstrated through an imaged transmission model, which solves the boring and difficult problems of learning complex protocol documents in the prior art, and significantly speeds up the learning progress.
Patent Information
- Application Number
- CN202211485743.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-24
- Publication Date
- 2025-04-29
- Estimated Expiration
- 2042-11-24
AI Technical Summary
In the prior art, when developing and testing chip firmware, it is necessary to understand the complex SATA, nvme and PCIE protocol documents, which makes the learning process boring and difficult. Especially for those who are just getting started, the complexity and length of protocol documents make the learning progress very slow.
Through a protocol-assisted learning implementation method, the command identifier is used to match, the target protocol is determined, and the corresponding command parameters are found in the preset protocol command parameter table. The parameter values of the command parameters are randomly generated and assembled according to the target protocol to generate an exemplary target command. At the same time, a transmission logic model is generated through the protocol model and displayed in an image manner, helping users understand the transmission process of commands.
Through this method, users can quickly obtain the command style and structure after the protocol conversion, save time to read the protocol instructions, significantly speed up the learning progress, and through the imaged transmission model, users can intuitively understand the transmission form of commands at different levels.
Smart Images

Figure CN115866085B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method, device, computer terminal and storage medium for implementing protocol-assisted learning. Background Art
[0002] Chip firmware development and testing require a good understanding of SATA (Serial Advanced Technology Attachment, serial hard disk) protocol or NVMe protocol and PCIE protocol. However, whether it is SATA protocol, NVMe protocol or PCIE protocol, the documents are all in pure English, and each document is hundreds of pages, with many attachments, and the content of the protocol document often jumps to various chapters, and you often forget the previous ones after reading the latter ones, so learning is a very boring and difficult process. At present, all companies are using the old employees to guide the new employees, and the new employees learn independently and ask the old employees for help if they don’t understand. After a period of time, the old employees will assign tasks to the new employees, and learn while working to speed up the progress. However, for beginners, there are basically problems with every page of the protocol, and it is impossible for the old employees to answer every question one by one, so the learning progress is still very slow. Summary of the invention
[0003] In a first aspect, the present application provides a protocol-assisted learning implementation method, comprising:
[0004] When the command identifier is read, the target protocol to be converted is determined, and the corresponding command parameters are searched in a preset protocol command parameter table according to the command identifier and the target protocol;
[0005] Obtaining the position and parameter value range of each of the command parameters, and randomly generating parameter values of each of the command parameters according to the value range;
[0006] The parameter values of the various command parameters are assembled according to the target protocol to generate a corresponding target command.
[0007] Furthermore, the method further comprises:
[0008] According to the protocol model, a transmission logic model of the target command in the protocol model is generated, wherein the transmission logic model is divided into different levels according to the details of the transmission steps;
[0009] Confirm the target level currently selected by the user, read the transmission logic model corresponding to the target level, and display the transmission form of the target command in the target level.
[0010] Furthermore, the transmission logic model is displayed in the form of a graphic;
[0011] The levels for confirming the current user selection include:
[0012] The hierarchical level input by the user, or the clicked position on the image of the transmission logic model is read to determine the transmission form of the target command under the hierarchy.
[0013] Further, the preset protocol command parameter table includes: a command column and a parameter column;
[0014] The command column includes the names of all commands, and the parameter column includes the parameters corresponding to the corresponding commands and the parameter value ranges.
[0015] Further, assembling the parameter values of each command parameter according to the target protocol to generate a corresponding target command includes:
[0016] Generate a command table, arrange the command parameters in sequence according to the target protocol and fill them into the command table, and fill in the corresponding parameter value in the column corresponding to each command parameter to generate the target command;
[0017] After the command table and the target command are generated, they are displayed on the terminal interface.
[0018] Furthermore, each table unit where the command parameter is located includes drop-down information, and the drop-down information is used to record the description of the command parameter.
[0019] Furthermore, the method further includes: determining command types supported by the target command, and generating the target command according to each command type.
[0020] In a second aspect, the present application also provides a protocol-assisted learning implementation device, including:
[0021] A matching module, used to determine the target protocol to be converted when reading the command identifier, and to search for corresponding command parameters in a preset protocol command parameter table according to the command identifier and the target protocol;
[0022] A parameter generation module, used to obtain the position and parameter value range of each of the command parameters, and randomly generate parameter values of each of the command parameters according to the value range;
[0023] The command assembly module is used to assemble the parameter values of each of the command parameters according to the target protocol to generate a corresponding target command.
[0024] In a third aspect, the present application also provides a computer terminal, comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program runs on the processor, the protocol-assisted learning implementation method is executed.
[0025] In a fourth aspect, the present application also provides a readable storage medium storing a computer program, which executes the protocol-assisted learning implementation method when running on a processor.
[0026] The present invention discloses a protocol-assisted learning implementation method, including: when reading a command identifier, determining a target protocol to be converted, matching in a preset protocol command parameter table according to the command identifier and the target protocol, and finding corresponding command parameters; obtaining the position and parameter value range of each command parameter, and randomly generating parameter values of each command parameter according to the value range; assembling the parameter values of each command parameter according to the target protocol to generate a corresponding target command. The command style and command structure after protocol conversion can be quickly obtained through the command identifier, and an exemplary command can be generated, so that the user can quickly know what the converted form of a command should be. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solution of the present invention, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and should not be regarded as limiting the scope of protection of the present invention. In each of the drawings, similar components are numbered similarly.
[0028] Figure 1 A schematic diagram of a protocol-assisted learning implementation method according to an embodiment of the present application is shown;
[0029] Figure 2 The following is a schematic diagram showing the command parameters of an embodiment of the present application;
[0030] Figure 3 The command representation schematic diagram of the embodiment of the present application is shown;
[0031] Figure 4 Another command representation schematic diagram of an embodiment of the present application is shown;
[0032] Figure 5 A command schematic diagram of an embodiment of the present application is shown;
[0033] Figure 6 A schematic diagram of command transmission in an embodiment of the present application is shown;
[0034] Figure 7 A schematic diagram of a five-layer model transmission structure of an embodiment of the present application is shown;
[0035] Figure 8 A schematic diagram of the structure of a protocol-assisted learning implementation device according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0036] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments.
[0037] The components of the embodiments of the present invention generally described and shown in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. 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.
[0038] Hereinafter, the terms "including", "having" and their cognates, which may be used in various embodiments of the present invention, are intended only to indicate specific features, numbers, steps, operations, elements, components or combinations of the foregoing items, and should not be understood as first excluding the existence of one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing items or adding the possibility of one or more features, numbers, steps, operations, elements, components or combinations of the foregoing items.
[0039] Furthermore, the terms “first”, “second”, “third”, etc. are merely used for distinguishing descriptions and are not to be understood as indicating or implying relative importance.
[0040] Unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meanings as those generally understood by those skilled in the art to which the various embodiments of the present invention belong. The terms (such as those defined in generally used dictionaries) will be interpreted as having the same meanings as the contextual meanings in the relevant technical field and will not be interpreted as having idealized meanings or overly formal meanings unless clearly defined in the various embodiments of the present invention.
[0041] This application is applied to requests for chip command-related protocols. Command conversion is required when the command is sent from the controller to the disk. The specific converted commands have different assembly formats according to different protocols, which are complex to set up and not easy to master. The protocol-assisted learning implementation method of this application establishes a protocol command parameter table, matches the command identifier, determines which command parameters correspond to the command identifier, how each parameter occupies a command, and the value range of each parameter, generates random exemplary target commands, and helps learners learn.
[0042] Next, the technical solution of the present application is described with specific embodiments.
[0043] Example 1
[0044] like Figure 1 As shown, the protocol-assisted learning implementation method of the present application includes the following steps:
[0045] Step S100, when the command identifier is read, the target protocol to be converted is determined, and a match is performed in a preset protocol command parameter table according to the command identifier and the target protocol to find the corresponding command parameters.
[0046] The protocol-assisted learning implementation method of the present application is used for students to learn SATA command protocol conversion. Different commands will have their own command identifiers, which vary depending on the issuing tools. For example, the command for reading the hard disk may have a command identifier of "read" or "rd" defined by a custom tool. These command identifiers are used to represent these specific SATA commands.
[0047] The target protocol refers to the protocol that the SATA command is to be converted into, such as the sg_raw command. There are many protocol standards for converting the command. Under different protocol standards, the resulting commands are also different. Therefore, when reading the command identifier, the target protocol to be converted is also determined to determine which protocol conversion the command needs to follow. It is understandable that the target protocol here can be set by yourself, and students can make the corresponding selection according to which protocol conversion they need to learn.
[0048] A command may have different composition methods and command parameters according to the protocol. The command parameters have their own meanings, and according to the protocol, the command is composed in a certain order.
[0049] For example, if a command is to read data from a hard disk, the command will require parameters such as the target address, source address, read type, etc. to be set so that the hard disk can run according to these parameters when executed. If the command is a storage command, compared to the parameters in the above example, there will be no command parameters such as the source address and read type.
[0050] Therefore, in this embodiment, in order to make the command identifiers and respective parameters correspond to each other, it is necessary to establish a command parameter table in advance. The command parameter table records each command word identifier.
[0051] The specific command parameter table is as follows Figure 2 shown.
[0052] The Command column records all command identifiers, and the Data column records the command parameters related to the corresponding command identifiers, as well as the value ranges corresponding to each command parameter. The correspondence between command identifiers and command parameters in the table, as well as the value ranges of the parameters, are established according to the provisions of the protocol. Different protocols have different command parameter tables.
[0053] Figure 2 Take 85h as an example. When the program reads a command identifier entered by the user, it will first traverse and query the command column. After finding the command, it will find the various command parameters related to 85h, that is, feature, lba, count, devcie, length, type. The different values of these command parameters can represent different effects and properties of the command. For example, length indicates whether the command supports 28bit or 48bit, or both. Lba can identify the address of the command, etc.
[0054] Step S200, obtaining the position and parameter value range of each command parameter, and randomly generating the parameter value of each command parameter according to the value range.
[0055] According to the provisions of the protocol, there are specific regulations on how to arrange the above command parameters to form the converted command. It is not possible to arbitrarily piece together these parameters to form a valid command. Different command parameters have different value ranges, so different parameters will have different number of bits. How to set the number of bits of different parameters also needs to be set according to the protocol rules. Therefore, it is necessary to determine the position of each command parameter first.
[0056] like Figure 3 As shown, it is a command table, which represents the assembly structure of a command under a protocol.
[0057] The first column on the left, byte\bit, represents the number of bits of the command, that is, the length of the command. There are 16 rows in total in the figure, which means a command has 16 bytes. The 7 to 0 in the first row on the right indicates that the length of each byte is 8 bits in binary. Below are the command parameters that should be filled in on each bit, as well as the number of bits corresponding to the command parameters.
[0058] For example, the byte numbered 0 is used as the command header to record the command identifier of the command. For example, the byte numbered 1 can be used to record three parameters, of which bits 7, 6, and 5 are used to record obsolete, bits 4, 3, 2, and 1 are used to record PROTOCOL, and bit 0 is used to record the extend parameter. The meanings of the above parameters are specified by the protocol and will not be repeated here.
[0059] The FEATURES (15:8) recorded in the subsequent byte labeled 3 indicates that the high 8 bits of the command parameter FEATURES need to be recorded in the byte labeled 3 of the command, and the parameters in other positions are described in the same way. The source of the data of each bit of the command and which position of which parameter can be determined.
[0060] Each parameter has its own range of values or fixed parameter values, such as Figure 2 In the command, the value of length is fixed at 48b, indicating that the command supports 48-bit format. The value of FEATURES is reserved, which is a parameter value in character format. The value range of the lba parameter is 0-65535. The value of lba is uncertain and has a limited range. Valid parameters can only be selected within this range. Therefore, for the above parameters with fixed values, the fixed value is used as the parameter value of the command parameter. For command parameters without fixed values but with a value range, a value is randomly selected from the value range as the parameter value of the command parameter.
[0061] Step S300, assembling the parameter values of each command parameter according to the target protocol to generate a corresponding target command.
[0062] After obtaining the parameter values of each command, these parameter values are assembled according to the structure in the above command table to form the final target command.
[0063] After filling in specific parameter values in the above command table, the resulting command table is as follows: Figure 4 As shown, it can be understood that no matter it is a number or a character, it is stored in the computer as a binary number of "0" or "1". For example, English can be converted into a binary number through the ACSII (American Standard Code for Information Interchange) code, and the binary number is converted into a more convenient hexadecimal number for display.
[0064] After the command character 85h is entered, the target command obtained in this step is in the following form:
[0065] "85072D000100F1001000000000402500"
[0066] The above command is the final target command. Since the parameters are all random numbers within the value range, the target command is just an example. Figure 3 Figure 4 The two command tables in the figure show the composition and meaning of each bit of data after a command is converted according to the protocol.
[0067] like Figure 5 The following figure shows the command style displayed to the user after the target command is formed. Each byte of the command is listed separately, and the tool name column and the drive letter column are used to explain what protocol the currently generated command is sent to and to what hard disk. A drop-down list button is set on each byte. By clicking the button, the user can get the explanation information of the byte, explaining the meaning, source and value range of the parameter. It is convenient for students to consult, and they do not need to read the complicated protocol manual to understand the composition of the command, which facilitates the understanding of the protocol.
[0068] Obviously, learners can input multiple different command identifiers in a short period of time to obtain multiple exemplary target commands. Through the structural display of each command, they can master the characteristics of different command structures, as well as the parameter sources and rules of each byte, saving the steps of flipping through protocol descriptions and other reading materials for reference.
[0069] In addition, it is a complicated process from powering on the hard disk to establishing a connection with the host, and then to sending and receiving commands between the host and the disk. According to the SATA protocol, the entire transmission structure is divided into five layers, namely the application layer, command layer, transport layer, link layer and physical layer. Among them, the command layer is included in the application layer, and can also be considered as a four-layer structure.
[0070] A command sent from the host to the disk will pass through these five layers, and the form of the command will change with each layer. Taking the above target command as an example, the command can be regarded as a data packet composed of a string. Through different layers, it will be necessary to add specific headers and tails to the data packet, or remove the header data, etc. Therefore, a command will go through multiple conversion operations from the beginning to the end of the sending, and the whole process is complicated and difficult to describe. The application layer, transport layer, and link layer of the host and the device can also interact logically. It can be seen that in different application scenarios, the transmission methods of commands are diverse and the transmission paths will also be different. Therefore, it is necessary to master the form of commands in these transmissions.
[0071] This application presents the changes in commands when they are transmitted between layers in the form of images based on the protocol model.
[0072] like Figure 6 The figure shows the simplest transmission situation, which is also the outermost transmission situation, that is, when the host 100 sends a command to the connected disk 200. Under this outermost model, the command sent from the host to the disk will be displayed, but the changes in the command when it is transmitted between each layer will not be displayed.
[0073] like Figure 7 As shown, compared with Figure 6For a more detailed command transmission diagram, the five-layer structure of the host and the disk is shown. This is the five-layer model for both the host and the disk device connected to the host. Commands can be sent from the host to the device, or from the device to the host, forming a command interaction.
[0074] For example Figure 6 The level is 1, Figure 7 The level is 2, then after the command and level are entered, the transmission image to be displayed to the user is determined according to the level data. For example, if the input level is 1, the display Figure 6 .
[0075] In the outer layer diagram, you can click on the module in the diagram to enter the deeper image, such as clicking Figure 6 The host in can enter Figure 7 The data transmission diagram in the figure can also be displayed separately on the host side. Figure 7 The specific form of the command when it is transmitted between layers will be displayed, and you can also click on the transmission path (the arrow in the figure) to see the details of the command conversion on the path.
[0076] The protocol-assisted learning implementation method provided by the present application reads the input command identifier and matches it in the command parameter table to determine the value range of each command parameter of the command, thereby generating an exemplary target command. In addition, the transmission process of the transmission command is presented in detail through a graphical transmission model, so that learners can intuitively and clearly understand a series of changes in the SATA command protocol transmission process and the composition structure principle of the command, helping students to learn quickly.
[0077] Example 2
[0078] like Figure 8 As shown, the present application also provides a protocol-assisted learning implementation device, including:
[0079] The matching module 10 is used to determine the target protocol to be converted when reading the command identifier, and to search for corresponding command parameters in a preset protocol command parameter table according to the command identifier and the target protocol;
[0080] The parameter generation module 20 is used to obtain the position and parameter value range of each of the command parameters, and randomly generate parameter values of each of the command parameters according to the value range;
[0081] The command assembling module 30 is used to assemble the parameter values of each of the command parameters according to the target protocol to generate a corresponding target command.
[0082] The present application also provides a computer terminal, including a processor and a memory, wherein the memory stores a computer program, and when the computer program runs on the processor, the protocol-assisted learning implementation method is executed.
[0083] The present application also provides a readable storage medium storing a computer program, wherein the computer program executes the protocol-assisted learning implementation method when running on a processor.
[0084] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and structure diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in an alternative implementation, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the structure diagram and / or the flow diagram, and the combination of boxes in the structure diagram and / or the flow diagram, can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0085] In addition, the functional modules or units in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0086] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0087] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A protocol-assisted learning implementation method, characterized in that: include: When the command identifier is read, the target protocol to be converted is determined, and the corresponding command parameters are searched in a preset protocol command parameter table according to the command identifier and the target protocol; Obtaining the position and parameter value range of each of the command parameters, and randomly generating parameter values of each of the command parameters according to the value range; Assembling the parameter values of each of the command parameters according to the target protocol to generate a corresponding target command; According to the protocol model, a transmission logic model of the target command in the protocol model is generated, wherein the transmission logic model is divided into different levels according to the details of the transmission steps; Confirm the target level currently selected by the user, read the transmission logic model corresponding to the target level, and display the transmission form of the target command in the target level; The transmission logic model is displayed in a graphical manner; The levels for confirming the current user selection include: The hierarchical level input by the user, or the clicked position on the image of the transmission logic model is read to determine the transmission form of the target command under the hierarchy.
2. The protocol-assisted learning implementation method according to claim 1, characterized in that: The preset protocol command parameter table includes: a command column and a parameter column; The command column includes the names of all commands, and the parameter column includes the parameters corresponding to the corresponding commands and the parameter value ranges.
3. The protocol-assisted learning implementation method according to claim 1, characterized in that: The step of assembling the parameter values of the command parameters according to the target protocol to generate the corresponding target command includes: Generate a command table, arrange the command parameters in sequence according to the target protocol and fill them into the command table, and fill in the corresponding parameter value in the column corresponding to each command parameter to generate the target command; After the command table and the target command are generated, they are displayed on the terminal interface.
4. The protocol-assisted learning implementation method according to claim 3, characterized in that: Each table cell where the command parameter is located includes drop-down information, and the drop-down information is used to record the description of the command parameter.
5. The protocol-assisted learning implementation method according to claim 1, characterized in that: Also includes: The command types supported by the target command are determined, and the target command is generated according to each of the command types.
6. A protocol-assisted learning implementation device, characterized in that: include: A matching module, used to determine the target protocol to be converted when reading the command identifier, and to search for corresponding command parameters in a preset protocol command parameter table according to the command identifier and the target protocol; A parameter generation module, used to obtain the position and parameter value range of each of the command parameters, and randomly generate parameter values of each of the command parameters according to the value range; A command assembly module, used to assemble the parameter values of each of the command parameters according to the target protocol to generate a corresponding target command; According to the protocol model, a transmission logic model of the target command in the protocol model is generated, wherein the transmission logic model is divided into different levels according to the details of the transmission steps; Confirm the target level currently selected by the user, read the transmission logic model corresponding to the target level, and display the transmission form of the target command in the target level; The transmission logic model is displayed in a graphical manner; The levels for confirming the current user selection include: The hierarchical level input by the user, or the clicked position on the image of the transmission logic model is read to determine the transmission form of the target command under the hierarchy.
7. A computer terminal, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is run on the processor, the method for implementing protocol-assisted learning according to any one of claims 1 to 5 is executed.
8. A readable storage medium, characterized in that: The computer program stores a computer program, which executes the protocol-assisted learning implementation method according to any one of claims 1 to 5 when running on a processor.
Citation Information
Patent Citations
Automatic framing meter reading method, equipment and device
CN112185093A