Command code-based mapping and data processing method and device, equipment and medium
By receiving mapping requests in the data processing system, processing and mapping command codes, and adding mapping flags, the problem of discontinuous and irrelevant command codes is solved, and the precise management and efficient processing of command codes in the storage device is realized, which improves the operation efficiency .
Patent Information
- Application Number
- CN202411044116.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-31
- Publication Date
- 2024-11-08
AI Technical Summary
When the existing data processing system sends commands to the storage device, the command codes are discontinuous and unrelated, resulting in increased code volume, low operating efficiency and low performance.
By receiving the mapping request, processing the data to be mapped, generating the command code to be mapped, and mapping it into continuous command code values, adding mapping flags to the continuous command code values to achieve type distinction of the mapped data.
It realizes precise management and efficient processing of command codes in storage devices, reduces the volume of command codes and improves operating efficiency.
Smart Images

Figure CN118915972A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a command code-based mapping, data processing method, device, equipment and medium. Background Art
[0002] As the amount of data grows explosively, data processing systems need to interact with storage devices efficiently to complete complex read and write operations. However, due to the high complexity of the field of data processing technology, the commands sent by the host to the storage device are numerous and lack a unified standard. These command codes are often non-continuous and lack direct logical associations with each other, causing the hard disk to have to perform complex parsing and conditional judgments when processing these commands. This unstructured command system not only greatly increases the complexity of the code and expands the code volume, but also directly affects the efficiency of command processing, thereby dragging down the performance of the entire data processing system.
[0003] Therefore, how to optimize the command management mechanism, reduce code size, improve code running efficiency, and enhance read and write performance while maintaining the flexibility and scalability of the data processing system has become an important issue that needs to be solved urgently. Summary of the invention
[0004] In view of this, the embodiments of the present application provide a command code-based mapping, data processing method, device, equipment and medium, which can effectively solve the problems of increased code size, low code running efficiency, and poor running performance in the existing method when the host sends a command to the storage device.
[0005] In a first aspect, an embodiment of the present application provides a command code-based mapping method, comprising:
[0006] Receiving a mapping request, processing the data to be mapped according to the mapping request, and obtaining a command code to be mapped;
[0007] Mapping the command code to be mapped to obtain a continuous mapping command code value;
[0008] A mapping flag is added to the continuous mapping command code value, and the mapping flag is used to distinguish the mapping data to obtain the type of the mapping data.
[0009] In some embodiments, the step of processing the data to be mapped according to the mapping request to obtain the command code to be mapped includes:
[0010] Classifying the data to be mapped into types according to the mapping request;
[0011] Extracting command codes of the same type from the data to be mapped to obtain a first type of command codes to be mapped from the data to be mapped;
[0012] The command codes of different types in the data to be mapped are extracted to obtain the second type of command codes to be mapped of the data to be mapped.
[0013] In some embodiments, mapping the command code to be mapped to obtain a continuous mapping command code value includes:
[0014] Mapping the plurality of command codes in the first type of command codes to be mapped into a plurality of continuous command code values in sequence to obtain a first type of command code value;
[0015] The plurality of command codes in the second type of command codes to be mapped are sequentially mapped into a plurality of continuous command code values to obtain second type command code values; the first type command code values and the second type command code values constitute the continuous mapped command code values.
[0016] In some embodiments, adding a mapping flag to the continuous mapping command code value includes:
[0017] Adding a first mapping flag to the first type command code value according to a mapping rule;
[0018] A second mapping flag is added to the second type command code value according to the mapping rule.
[0019] In some embodiments, adding a first mapping flag to the first type command code value according to a mapping rule further includes:
[0020] Performing bit determination on the first type command code value added with the first mapping flag;
[0021] When the number of bits of the first mapping flag in the first type command code value is the first preset number of bits, the first type command code value having the first preset number of bits is set as the first mapping data type;
[0022] When the number of bits of the first mapping flag in the first type command code value is the second preset number of bits, the first type command code value having the second preset number of bits is set as the second mapping data type.
[0023] In some embodiments, adding a second mapping flag to the second type command code value according to the mapping rule further includes:
[0024] Parsing the second type command code value added with the second mapping flag;
[0025] The data type of the second type command code added with the second mapping flag is set according to a preset rule; the data type is used to determine the mapping data type of the second type command code.
[0026] In a second aspect, an embodiment of the present application provides a data processing method, including:
[0027] Acquire continuous command code values corresponding to the mapping data, wherein the continuous command code values are obtained by mapping the mapping data using the command code-based mapping method described in the first aspect above;
[0028] The type of the mapping data is obtained according to the start value, the end value and the mapping flag in the continuous command code value.
[0029] In a third aspect, an embodiment of the present application provides a command code-based mapping device, comprising:
[0030] The to-be-mapped data processing module is used to receive a mapping request, process the to-be-mapped data according to the mapping request, and obtain a to-be-mapped command code;
[0031] A mapping command code module, used for mapping the command code to be mapped to obtain a continuous mapping command code value;
[0032] A mapping flag adding module is used to add a mapping flag to the continuous mapping command code value, and the mapping flag is used to distinguish the mapping data to obtain the type of the mapping data.
[0033] In a fourth aspect, an embodiment of the present application provides a computer device, comprising a processor and a memory, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement the command code-based mapping method described in the first aspect or to implement the data processing method described in the second aspect.
[0034] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium storing a computer program. When the computer program is executed on a processor, it implements the command code-based mapping method described in the first aspect or the data processing method described in the second aspect.
[0035] The embodiments of the present application have the following beneficial effects: the command code-based mapping, data processing method, device, equipment and medium of the present application firstly receives a mapping request, processes the data to be mapped according to the mapping request, obtains the command code to be mapped, then maps the command code to be mapped, obtains a continuous mapping command code value, and finally adds a mapping flag to the continuous mapping command code value, so that the mapping data can be distinguished by the mapping flag to obtain the type of the mapping data. The command code-based mapping, data processing method, device, equipment and medium of the present application not only realizes the accurate management and efficient processing of the command code in the storage device, but also significantly reduces the volume of the command code in the storage device, and improves the operation efficiency of the command code. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 An application scenario diagram of the command code-based mapping method according to an embodiment of the present application is shown;
[0038] Figure 2 A flowchart of a command code-based mapping method according to an embodiment of the present application is shown;
[0039] Figure 3 Another flow chart of a command code-based mapping method according to an embodiment of the present application is shown;
[0040] Figure 4 Another flow chart of a command code-based mapping method according to an embodiment of the present application is shown;
[0041] Figure 5 Another flow chart of a command code-based mapping method according to an embodiment of the present application is shown;
[0042] Figure 6 Another flow chart of a command code-based mapping method according to an embodiment of the present application is shown;
[0043] Figure 7 Another flow chart of a command code-based mapping method according to an embodiment of the present application is shown;
[0044] Figure 8 A structural schematic diagram of a command code-based mapping method according to an embodiment of the present application is shown. DETAILED DESCRIPTION
[0045] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments.
[0046] The components of the embodiments of the present application generally described and shown in the drawings herein may be arranged and designed in various configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present application.
[0047] Hereinafter, the terms "including", "having" and their cognates that can be used in various embodiments of the present application are intended only to indicate specific features, numbers, steps, operations, elements, components or a combination 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 a combination of the foregoing items or increasing the possibility of one or more features, numbers, steps, operations, elements, components or a combination of the foregoing items. In addition, the terms "first", "second", "third" and the like are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance.
[0048] 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 application 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 application.
[0049] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0050] Considering that in the existing methods, when the host sends commands to the storage device, there are problems such as discontinuous, irrelevant and irregular command codes, and the resulting problems that the storage device cannot judge multiple commands, the code volume increases, the code operation efficiency is low, and the operation performance is low. Therefore, the present application proposes a mapping, data processing method, device, equipment and medium based on command codes, which provides a key intermediate link for the conversion and integration of the data to be mapped by receiving a mapping request, processing the data to be mapped, and generating the corresponding command code to be mapped, thereby ensuring that the converted data to be mapped can meet the requirements of the subsequent mapping process. Subsequently, by applying the mapping rules to the command code to be mapped and generating a continuous mapping command code value, the effective conversion and mapping of the command code between different formats is realized. Finally, by adding a mapping flag to the continuous mapping command code value, the mapping data is finally distinguished by the mapping flag, and the type of the mapping data is obtained, which provides a clear distinction and identification mechanism for the mapped command code. The command code-based mapping, data processing method, device, equipment and medium of the embodiments of the present application not only realize the accurate management and efficient processing of the command codes in the storage device, but also significantly reduce the volume of the command codes in the storage device and improve the operating efficiency of the command codes.
[0051] The command code-based mapping method is described below in conjunction with some specific embodiments.
[0052] Figure 1 FIG. 1 is a schematic diagram showing an application environment of a command code-based mapping method according to an embodiment of the present application. Exemplarily, the command code-based mapping method according to the present application is applied in a computer system, which includes: Figure 1 The host and storage device shown in the figure communicate with each other through interfaces or protocols. The host usually refers to the core part of the computer system, including the central processing unit (CPU), motherboard, memory, power supply, and possible other components (such as graphics card, sound card, network card, etc.). It is the center of computer data processing and control. Storage devices are hardware components used to store data and programs, which can store information long-term or temporarily for reading and use by computer systems.
[0053] Figure 2 A flowchart of a command code-based mapping method according to an embodiment of the present application is shown. The command code-based mapping method comprises the following steps:
[0054] Step S100, receiving a mapping request, processing the data to be mapped according to the mapping request, and obtaining a command code to be mapped.
[0055] Exemplarily, the storage device receives a mapping request from an external or internal module, and the mapping request generally includes information such as the identification, type, format, and target mapping rule of the data to be mapped. The mapping request may be triggered by a user through a user interface, or may be automatically generated by another system component according to a preset logic.
[0056] When receiving a mapping request, the storage device pre-processes the data to be mapped according to the rules or parameters specified in the mapping request. For example, the data in the mapping request is parsed to extract the specific data items, data formats, and any accompanying mapping rules or parameters that need to be mapped. After processing the data to be mapped, the storage device generates one or more command codes to be mapped based on the mapping results or certain key information in the process. In subsequent steps, the command codes to be mapped can also be divided by type to better manage the command codes to be mapped.
[0057] Step S200, mapping the command code to be mapped to obtain a continuous mapping command code value.
[0058] Exemplarily, the information contained in the command code to be mapped is parsed, and the mapping operation is performed on the command code to be mapped using corresponding mapping rules or algorithms according to the parsed information. After the mapping is completed, a continuous mapping command code value is generated, wherein the continuous mapping command code values are arranged according to a certain logic or sequence for subsequent processing or execution.
[0059] After generating continuous mapping command code values, the storage device may need to perform verification and validation operations, for example, checking whether the mapping command code values meet expectations, whether there are omissions or errors, etc., to ensure the accuracy and completeness of the mapping results.
[0060] Step S300: adding a mapping flag to the continuous mapping command code value, wherein the mapping flag is used to distinguish the mapping data to obtain the type of the mapping data.
[0061] Exemplarily, a mapping flag is an identifier specific to the data mapping process, which is used to uniquely identify or classify the mapped data. The main purpose of the mapping flag is to provide a mechanism so that the storage device receiving or processing the mapped data can easily identify the source, type, status or other important attributes of the data. By checking the mapping flag, the type of the mapped data can be quickly determined.
[0062] For example, the mapping mark can be represented by numbers, letters, symbols or a combination thereof, or by a more complex encoding method. It is worth noting that the uniqueness, scalability and readability of the mapping mark need to be considered during design.
[0063] The mapping flag can be directly added to the continuous mapping command code value in the form of a field, or it can be associated with the mapping data as metadata. No matter which method is used, it is necessary to ensure that the corresponding relationship between the mapping flag and the mapping data is clear and unambiguous, and not easy to be lost or confused.
[0064] A command code-based mapping method proposed in an embodiment of the present application first receives a mapping request, processes the data to be mapped, and generates the corresponding command code to be mapped, providing a key intermediate link for the conversion and integration of the data to be mapped, thereby ensuring that the converted data to be mapped can meet the requirements of the subsequent mapping process. Subsequently, by applying mapping rules to the command code to be mapped, a continuous mapping command code value is generated, thereby realizing the effective conversion and mapping of command codes between different formats. Finally, by adding a mapping flag to the continuous mapping command code value, the mapping data is finally distinguished by the mapping flag, and the type of the mapping data is obtained, providing a clear distinction and identification mechanism for the mapped command code. The command code-based mapping, data processing method, device, equipment and medium of the embodiment of the present application not only realize the accurate management and efficient processing of the command code in the storage device, but also significantly reduce the volume of the command code in the storage device and improve the operation efficiency of the command code.
[0065] In an optional embodiment, if Figure 3 As shown, in step S100, the data to be mapped is processed according to the mapping request to obtain a command code to be mapped, including:
[0066] Step S101: classify the data to be mapped according to the mapping request.
[0067] Exemplarily, the data types to be divided can be determined according to the mapping request and the characteristics of the data to be mapped. For example, the types of data to be mapped may include media access type, Power Management, read / write, buffer, Security, Multiple, Nop, Sleep, PIO, DMA, NCQ, FUA, etc.
[0068] It is worth noting that the above types are not fixed classifications for all data to be mapped, but are determined according to specific application scenarios and requirements.
[0069] Step S102: extracting command codes of the same type from the data to be mapped to obtain a first type of command codes to be mapped from the data to be mapped.
[0070] Exemplarily, all command codes belonging to the same type are identified and extracted from the data to be mapped. This generally involves analyzing the data to be mapped to determine which command codes have common features or attributes so that they can be classified as the same type, thereby obtaining a first type of command codes to be mapped: that is, the "first type of command codes to be mapped" represents a specific subset of the data to be mapped, which subset contains all command codes identified as the same type.
[0071] Step S103: extract the command codes of different types from the data to be mapped to obtain the second type of command codes to be mapped of the data to be mapped.
[0072] Exemplarily, by carefully analyzing the data to be mapped, command codes that do not belong to the same type are identified and extracted, so as to accurately distinguish different types of command codes.
[0073] In actual applications, the storage device may not be able to accurately identify whether some of the data to be mapped belongs to the same type; or due to some misjudgment, there may be multiple pieces of data to be mapped. At this time, if these pieces of data to be mapped belong to different types and we need to process them, we can choose to extract one of them as the representative data to be mapped for processing.
[0074] The command code-based mapping method of the embodiment of the present application extracts the to-be-mapped data of the same type and the command codes of different types from the to-be-mapped data, thereby ensuring that the converted to-be-mapped command codes can meet the requirements of the subsequent mapping process.
[0075] In an optional embodiment, if Figure 4As shown, in step S200, mapping the command code to be mapped to obtain a continuous mapping command code value includes:
[0076] Step S201: Map multiple command codes in the first type of command codes to be mapped into multiple continuous command code values in sequence to obtain first type command code values.
[0077] Exemplarily, the plurality of command codes in the first type of command codes to be mapped extracted in step S102 are sequentially mapped to obtain continuous first type command code values. The first type command code values have a unified format and structure so that subsequent processing storage devices can easily identify and process them.
[0078] For example, the original read / write type and buffer type command codes are: 0xE4, 0xE9, 0xE8, 0xEB;
[0079] Remap the original read / write type and buffer type command codes to 0x16, 0x17, 0x18, and 0x19; that is, the first type command code values are 0x16, 0x17, 0x18, and 0x19;
[0080] Step S202: sequentially map multiple command codes in the second type of command codes to be mapped into multiple continuous command code values to obtain second type command code values; the first type command code values and the second type command code values constitute the continuous mapped command code values.
[0081] Exemplarily, multiple command codes in the second type of command codes to be mapped extracted in the above step S103 are mapped in sequence to obtain continuous second type command code values.
[0082] For example, the original Power Management type command codes are: 0xE0, 0xE1, 0xE2, 0xE3, 0xE5, 0xE6;
[0083] The original Power Management command code is remapped to: 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21; that is, the second type command code values are 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21.
[0084] The command code-based mapping method of the embodiment of the present application obtains continuous first-type command code values and second-type command code values by processing the first-type command codes to be mapped and the second-type command codes to be mapped, thereby ensuring compliance with the requirements of the subsequent mapping process.
[0085] In an optional embodiment, if Figure 5As shown, in step S300, adding a mapping flag to the continuous mapping command code value includes:
[0086] Step S301, adding a first mapping flag to the first type command code value according to a mapping rule;
[0087] Exemplarily, the command code value to which the mapping flag needs to be added is identified, and the first mapping flag is inserted into the command code value according to the mapping rule and the preset adding position and format.
[0088] For example, the first type of command code value can be a 48-bit command code value or a 28-bit command code value. In this case, the first mapping flag of the first type of command code value is set to bit 8. That is, the mapping flag of the 48-bit command code value is bit 8, and the mapping flag of the 28-bit command code value is bit 8. Among them, bit 8 refers to the 8th bit counted from the least significant bit (LSB) of the command code value.
[0089] After the first mapping flag is inserted into the first type command code value, the first type command code value after adding the first mapping flag can also be verified to ensure that the mapping flag has been correctly added and does not affect other parts of the command code value. The verification process may include format checking, logical consistency checking, etc.
[0090] Step S302: adding a second mapping flag to the second type command code value according to a mapping rule.
[0091] Exemplarily, the second type command code value refers to a command code for reading and writing user data types. At this time, the second mapping flag of the second type command code value is set to read / write, dma / pio, 28bit / 48bit, fua / non-fua.
[0092] For example, the command code value of the read-write user data is remapped, and the second mapping flags of read / write, dma / pio, 28bit / 48bit, fua / non-fua are added to the command code value of the read-write user data.
[0093] The command code-based mapping method of the embodiment of the present application processes different types of command codes and adds corresponding mapping flags according to the mapping rules to facilitate the distinction of command codes in subsequent steps, thereby achieving accurate management and efficient processing of command codes in storage devices, significantly reducing the size of command codes in storage devices, and improving the operating efficiency of command codes.
[0094] In an optional embodiment, if Figure 6As shown, in step S301, after adding the first mapping flag according to the mapping rule, it also includes:
[0095] Step S303, determining the number of bits of the first type command code value added with the first mapping flag;
[0096] Exemplarily, the first type command code may be 28 bits or 48 bits. It should be noted that the value of the number of bits of the first type command code is only an example and can be adaptively adjusted according to specific circumstances.
[0097] Step S304, when the number of bits of the first mapping flag in the first type command code value is the first preset number of bits, setting the first type command code value having the first preset number of bits as the first mapping data type;
[0098] Exemplarily, when remapping the command code, when the first type command code value is a 48-bit command code, its corresponding first mapping flag is bit8. At this time, bit8 is set to 1, that is, the first mapping data type is 1.
[0099] It is worth noting that the above-mentioned values of the first mapping flag and the first mapping data type are only examples and can be adaptively adjusted according to specific circumstances.
[0100] Step S305: when the number of bits of the first mapping flag in the first type command code value is the second preset number of bits, the first type command code value having the second preset number of bits is set as the second mapping data type.
[0101] Exemplarily, when the first type command code value is a 28-bit command code, its corresponding first mapping flag is bit8. At this time, bit8 is set to 0, that is, the second mapping data type is 0.
[0102] That is, when the first type command code value is a 48-bit command code, the first mapping flag is bit8, and the first mapping data type is 1;
[0103] When the first type command code value is a 28-bit command code, the first mapping flag is bit8 and the second mapping data type is 0.
[0104] It is worth noting that the above-mentioned values of the first type command code value, the first mapping flag, the first mapping data type, and the second mapping data type are only examples and can be adaptively adjusted according to specific circumstances.
[0105] The command code-based mapping method of the embodiment of the present application further limits the setting of a first type of command code value having a first preset number of bits as a first mapping data type and the setting of a first type of command code value having a second preset number of bits as a second mapping data type, so as to better distinguish the command codes in subsequent steps, thereby achieving accurate management and efficient processing of command codes in the storage device, significantly reducing the size of the command codes in the storage device, and improving the operating efficiency of the command codes.
[0106] In an optional embodiment, if Figure 7 As shown, in step S302, after adding the second mapping flag according to the mapping rule, it also includes:
[0107] Step S306, parsing the second type command code value added with the second mapping flag;
[0108] Exemplarily, the second mapping flags are read / write, dma / pio, 28bit / 48bit, fua / non-fua.
[0109] Step S307, setting the data type of the second type command code added with the second mapping flag according to a preset rule; the data type is used to determine the mapping data type of the second type command code.
[0110] Exemplarily, the preset rule is: if the command is non-fua, bit3 of the command code is set to 0; if the command is a fua command, bit3 of the command code is set to 1 during mapping;
[0111] If the command is a pio command, set bit 2 of the command code to 0 during mapping; if the command is a dma command, set bit 2 of the command code to 1 during mapping;
[0112] If the command is 28 bits, set bit 1 of the command code to 0 during mapping; if the command is 48 bits, set bit 1 of the command code to 1 during mapping;
[0113] If the command is a read command, bit 0 of the command code is set to 0 during mapping; if the command is a write command, bit 0 of the command code is set to 1 during mapping;
[0114] That is, the command type of the second type command code value added with the second mapping mark is parsed first, and then the data type of the second type command code is set according to the “preset rule” information.
[0115] For example, "dma28 write command A, the original command code is 3, and its command code is remapped to 5 through the rules". The command types of the second type of command code value are parsed according to the preset rules as dma command type, 28-bit command type and write command type. The data type bit2 corresponding to the dma command type is 1; the data type bit1 corresponding to the 28-bit command type is 0; the data type bit0 corresponding to the write command type is 1.
[0116] The command code-based mapping method of the embodiment of the present application sets the third mapping data type of the second type of command code through preset rules, so as to better distinguish the command codes in subsequent steps, thereby realizing accurate management and efficient processing of the command codes in the storage device, significantly reducing the volume of the command codes in the storage device, and improving the operating efficiency of the command codes.
[0117] In one embodiment, the present application further provides a data processing method based on a command code, the data processing method comprising the following steps:
[0118] Acquire continuous command code values corresponding to the mapping data, wherein the continuous command code values are obtained by mapping the mapping data using the command code-based mapping method described in the above embodiments.
[0119] Exemplarily, referring to the above-mentioned embodiment of the mapping method based on command codes, the details are not repeated here.
[0120] The type of the mapping data is obtained according to the start value, the end value and the mapping flag in the continuous command code value.
[0121] Exemplarily, the determination of dozens of command codes can be replaced by determining the start command code value, the end command code value, and the mapping mark value of the continuous command code values.
[0122] For example, there are functions on the storage device that need to check whether the command is included in the following commands: IDENTIFYDEVICE(0xEC), REQUEST SENSE DATA EXT(0xB), EXECUTE DEVICE DIAGNOSTIC(0x90), NOP(0x0), SET MULTIPLE MODE(0xC6), SET FEATURES(0xEF), READ BUFFER(0xE4), READBUFFER DMA(0xE9), WRITE BUFFER(0xE8), WRITE BUFFER DMA(0xEB), READ LOG EXT(0x2F), READ LOG DMA EXT(0x47), STANDBY IMMEDIATE(0xE0), STANDBY(0xE2), IDLEIMMEDIATE(0xE1), IDLE(0xE3), CHECK POWER MODE(0xE5), SLEEP(0xE6), SECURITY UNLOCK(0xF2), SECURITY ERASE PREPARE (0xF3).
[0123] There are 20 commands to be checked, including Multiple (Set Multiple Mode), R / Wlog (Read Log EXT...), Power Management Set (Idle, Standby...), Security Feature (Security Unlock...), Identify, Nop and other commands. After mapping these command codes to obtain continuous command code values, you only need to judge:
[0124] “((command code & 0X7F)>=IDENTIFY DEVICE)&((command code & 0x7F)<=SECURITY ERASEPREPARE)” The command code-based data processing method of the embodiment of the present application, after being mapped to continuous command code values, can obtain the command type by only judging the starting command code value, the ending command code value, and the mapping flag value, thereby realizing accurate management and efficient processing of the command code, significantly reducing the size of the command code, and improving the operating efficiency of the command code.
[0125] Figure 8 A schematic diagram of a structure of a command code-based mapping device according to an embodiment of the present application is shown. The command code-based mapping device includes:
[0126] The to-be-mapped data processing module 81 is used to receive a mapping request, process the to-be-mapped data according to the mapping request, and obtain a to-be-mapped command code.
[0127] The mapping command code module 82 is used to map the command code to be mapped to obtain continuous mapping command code values.
[0128] The mapping flag adding module 83 is used to add a mapping flag to the continuous mapping command code value, and the mapping flag is used to distinguish the mapping data to obtain the type of the mapping data.
[0129] Optionally, the to-be-mapped data processing module includes:
[0130] A type classification unit is used to classify the to-be-mapped data into types according to the mapping request.
[0131] The first type of command code to be mapped extraction unit is used to extract command codes of the same type from the data to be mapped to obtain the first type of command codes to be mapped from the data to be mapped.
[0132] The second type of command code to be mapped extraction unit is used to extract the command codes of different types from the data to be mapped to obtain the second type of command codes to be mapped from the data to be mapped.
[0133] Optionally, the to-be-mapped data processing module includes:
[0134] The first type command code value acquiring unit is used to sequentially map multiple command codes in the first type of command codes to be mapped into multiple continuous command code values to obtain first type command code values.
[0135] The second type command code value acquisition unit is used to map multiple command codes in the second type of command code to be mapped into multiple continuous command code values in sequence to obtain second type command code values; the first type command code value and the second type command code value constitute the continuous mapping command code value.
[0136] Optionally, the mapping flag is added to the module, including:
[0137] The first mapping mark adding unit is used to add a first mapping mark to the first type command code value according to a mapping rule.
[0138] The second mapping mark adding unit is used to add a second mapping mark to the second type command code value according to the mapping rule.
[0139] Optionally, the first mapping mark adding unit further includes:
[0140] The first type command code value judgment subunit is used to judge the number of bits of the first type command code value added with the first mapping mark.
[0141] The first mapping data type setting subunit is used to set the first type command code value having the first preset number of bits as the first mapping data type when the number of bits of the first mapping flag in the first type command code value is the first preset number of bits.
[0142] The second mapping data type setting subunit is used to set the first type command code value having the second preset number of bits as the second mapping data type when the number of bits of the first mapping flag in the first type command code value is the second preset number of bits.
[0143] Optionally, the second mapping mark adding unit further includes:
[0144] The second type command code value parsing subunit is used to parse the second type command code value added with the second mapping mark.
[0145] The mapping data type judgment subunit is used to set the third mapping data type of the second type command code added with the second mapping flag according to a preset rule; the third mapping data type is used to judge the mapping data type of the second type command code.
[0146] It can be understood that the device of this embodiment corresponds to the command code-based mapping method of the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described repeatedly here.
[0147] The present application also provides a computer device. Exemplarily, the computer device includes a processor and a memory, wherein the memory stores a computer program, and the processor runs the computer program to enable the terminal device to execute the functions of each module in the above-mentioned command code-based mapping method or the above-mentioned command code-based mapping device.
[0148] Among them, the processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including a central processing unit (CPU), a graphics processing unit (GPU) and a network processor (NP), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or at least one of other programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., which can implement or execute the disclosed methods, steps and logic block diagrams in the embodiments of the present application.
[0149] The memory may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc. The memory is used to store a computer program, and the processor may execute the computer program accordingly after receiving an execution instruction.
[0150] The present application also provides a computer-readable storage medium for storing the computer program used in the above-mentioned computer device. For example, the computer-readable storage medium may include, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0151] 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 application. 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.
[0152] In addition, the functional modules or units in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0153] 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 application, 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, which is stored in a storage medium and includes 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 methods described in the various embodiments of the present application.
[0154] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A mapping method based on command codes, It is characterized in that include: Receiving a mapping request, processing the data to be mapped according to the mapping request, and obtaining a command code to be mapped; Mapping the command code to be mapped to obtain a continuous mapping command code value; A mapping flag is added to the continuous mapping command code value, and the mapping flag is used to distinguish the mapping data to obtain the type of the mapping data.
2. The command code-based mapping method according to claim 1, It is characterized in that The step of processing the data to be mapped according to the mapping request to obtain a command code to be mapped includes: Classifying the data to be mapped into types according to the mapping request; Extracting command codes of the same type from the data to be mapped to obtain a first type of command codes to be mapped from the data to be mapped; The command codes of different types in the data to be mapped are extracted to obtain the second type of command codes to be mapped of the data to be mapped.
3. The command code-based mapping method according to claim 1, It is characterized in that Mapping the command code to be mapped to obtain a continuous mapping command code value includes: Mapping the plurality of command codes in the first type of command codes to be mapped into a plurality of continuous command code values in sequence to obtain a first type of command code value; The plurality of command codes in the second type of command codes to be mapped are sequentially mapped into a plurality of continuous command code values to obtain second type command code values; the first type command code values and the second type command code values constitute the continuous mapped command code values.
4. The command code-based mapping method according to claim 3, It is characterized in that The adding of a mapping flag to the continuous mapping command code value comprises: Adding a first mapping flag to the first type command code value according to a mapping rule; A second mapping flag is added to the second type command code value according to the mapping rule.
5. The command code-based mapping method according to claim 4, It is characterized in that The adding a first mapping flag to the first type command code value according to the mapping rule also includes: Performing bit determination on the first type command code value added with the first mapping flag; When the number of bits of the first mapping flag in the first type command code value is the first preset number of bits, the first type command code value having the first preset number of bits is set as the first mapping data type; When the number of bits of the first mapping flag in the first type command code value is the second preset number of bits, the first type command code value having the second preset number of bits is set as the second mapping data type.
6. The command code-based mapping method according to claim 4, It is characterized in that The adding a second mapping flag to the second type command code value according to the mapping rule also includes: Parsing the second type command code value added with the second mapping flag; The data type of the second type command code added with the second mapping flag is set according to a preset rule; the data type is used to determine the mapping data type of the second type command code.
7. A data processing method, It is characterized in that include: Acquire continuous command code values corresponding to the mapping data, wherein the continuous command code values are obtained by mapping the mapping data using a command code-based mapping method according to any one of claims 1 to 6; The type of the mapping data is obtained according to the start value, the end value and the mapping flag in the continuous command code value.
8. A mapping device based on command codes, It is characterized in that include: The to-be-mapped data processing module is used to receive a mapping request, process the to-be-mapped data according to the mapping request, and obtain a to-be-mapped command code; A mapping command code module, used for mapping the command code to be mapped to obtain a continuous mapping command code value; A mapping flag adding module is used to add a mapping flag to the continuous mapping command code value, and the mapping flag is used to distinguish the mapping data to obtain the type of the mapping data.
9. A computer device, It is characterized in that The computer device comprises a processor and a memory, wherein the memory stores a computer program, and the processor is used to execute the computer program to implement the command code-based mapping method according to any one of claims 1 to 6 or the data processing method according to claim 7.
10. A computer-readable storage medium, It is characterized in that It stores a computer program, which, when executed on a processor, implements the command code-based mapping method as described in any one of claims 1 to 6 or the data processing method as described in claim 7.
