A method, system, device, and storage medium for device memory cleanup
By acquiring device information, setting step size and read/write start position, and using the IPMI tool to select multiplexer channels, the problem of low efficiency in clearing device memory on the I2C bus was solved, achieving efficient and accurate memory clearing.
Patent Information
- Application Number
- CN202211002872.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-19
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2042-08-19
AI Technical Summary
In the existing technology, the device memory cleanup efficiency on the I2C bus is low. Traditional tools cannot clear a large number of registers at once, and IPMI tools are prone to failure when accessing multiplexer channels indirectly, which increases the workload.
By acquiring device information, determining the register mode, setting different step sizes, initializing the read/write start position, calling the IPMI tool to select the multiplexer channel, and reading and writing data along the channel from the start position until the memory is cleared.
It enables efficient and accurate clearing of device memory, whether it is a single-byte or double-byte register, directly or indirectly connected to the I2C bus, avoiding the inefficiency of traditional tools and the failure problems of IPMI tools.
Smart Images

Figure CN115373601B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of memory cleaning, and particularly relates to a method, system, device and storage medium for cleaning device memory. BACKGROUND
[0002] I2C (Inter-Integrated Circuit) is a bidirectional synchronous serial bus, and multiple devices can be connected to the bus. The bus is divided into a master device and a slave device, and only one master device can be connected to the bus at the same time, but multiple slave devices can be connected to the bus. The bus is composed of two lines, one of which is SDA, a synchronous data line, used for transmitting data between the master device and the slave device; and the other is SCL, a synchronous clock line, used for synchronizing time between the master device and the slave device. Data is transmitted bit by bit in series on the bus. Multiple devices are connected to the I2C bus, and each device has a certain storage space that can be used to store some related data. Different values of these data represent different information or different functions, and different functions can be achieved by reading or writing the data through I2C. After a long time of use, the data in the storage space of the device will be disordered, and sometimes the data needs to be emptied to restore the default function.
[0003] To empty the device memory connected to the I2C bus, one method is to use a traditional I2C tool to write data to the registers in the memory. However, the traditional I2C tool can only write one register at a time, and the registers in the device memory connected to the I2C bus are often hundreds or even thousands or tens of thousands. Such operation is too inefficient, and the traditional tool can only read and write single-byte registers. If the register is double-byte, the I2C tool cannot read and write it. Another method is to use an IPMI tool to write data to the registers in the device memory. The IPMI tool can read and write double-byte registers and can read and write multiple data at a time. However, it is still not possible to read and write all the data in the registers at a time. To empty the device memory connected to the I2C bus, a large number of repeated operations are required to empty the device memory. In order to expand the number of devices that can be connected to the I2C bus, a multiplexer is often connected to the I2C bus first, and then the devices are connected to the channels of the multiplexer. In this way, neither the I2C tool nor the IPMI tool can directly access the device. The channel of the multiplexer needs to be selected first, and then the device can be accessed. However, the IPMI process polls between different channels of the multiplexer, that is, it continuously selects a channel and deselects the previously selected channel. Therefore, even if the channel of the multiplexer is selected and the device connected to the channel is accessed, it may fail because the channel connected to the device may have been deselected when the device is accessed. Therefore, repeated operations are required, which increases the workload. SUMMARY
[0004] In order to solve the above technical problems, the application provides a device memory cleaning method, system, device and storage medium. The method can empty the device memory no matter whether the register is single byte or double byte, no matter whether the device memory is directly connected to the I2C bus or indirectly connected to the I2C bus through a multiplexer, and no matter how large the device memory space is.
[0005] To achieve the above object, the application adopts the following technical scheme:
[0006] The application provides a device memory cleaning method, which comprises the following steps:
[0007] Obtaining first information of a device; the first information comprises an I2C bus to which the device is connected, a device address and a device memory capacity;
[0008] After obtaining the first information of the device, judging a register mode corresponding to the device memory, setting different step lengths according to the register mode, and then initializing a read-write starting position;
[0009] Obtaining a multiplexer address of the device and selecting a channel of the multiplexer, and reading and writing step length data from the starting position along the channel of the multiplexer;
[0010] Reassigning the starting position; if the starting position is greater than the device memory capacity after reassignment, emptying the register corresponding to the memory.
[0011] Further, the process of setting different step lengths according to the register mode comprises:
[0012] When the mode of the register is byte, setting a first step length;
[0013] When the mode of the register is word, setting a second step length.
[0014] Further, the first step length is set to 0x10; and the second step length is set to 0x80.
[0015] Further, the process of selecting the channel of the multiplexer comprises: calling an IPMI tool to select the channel of the multiplexer.
[0016] Further, the process of reading and writing step length data from the starting position comprises: calling an IPMI tool to read and write step length data from the starting position at one time.
[0017] Further, the process of emptying the register corresponding to the memory comprises: writing 0xff into the register to empty the register corresponding to the memory.
[0018] The application further provides a system for device memory cleaning, comprising an acquisition module, a judgment module, a selection module and an emptying module.
[0019] The acquisition module is configured to acquire first information of the device, wherein the first information comprises an I2C bus connected by the device, a device address and a device memory capacity.
[0020] The judgment module is configured to judge a register mode corresponding to the device memory after acquiring the first information of the device, set different step lengths according to the register mode and then initialize a read-write starting position.
[0021] The selection module is configured to acquire a multiplexer address of the device and select a channel of the multiplexer, read and write step length data along the channel of the multiplexer from the starting position.
[0022] The emptying module is configured to reassign the starting position, and if the starting position is greater than the device memory capacity after reassignment, empty the register corresponding to the memory.
[0023] Further, the process executed by the emptying module comprises writing 0xff into the register to empty the register corresponding to the memory.
[0024] The application further provides a device, comprising:
[0025] a memory configured to store a computer program;
[0026] a processor configured to execute the computer program to realize the method steps.
[0027] The application further provides a readable storage medium, wherein the readable storage medium stores a computer program, and the computer program is executed by a processor to realize the method steps.
[0028] The effects provided in the summary are only the effects of the embodiments, and are not all the effects of the application, and one of the above technical solutions has the following advantages or beneficial effects:
[0029] The application provides a device memory cleaning method, system, device and storage medium, which comprises the following steps: obtaining first information of the device; the first information comprises an I2C bus connected by the device, a device address and a device memory capacity; after obtaining the first information of the device, determining a register mode corresponding to the device memory, setting different step lengths according to the register mode, and then initializing a read-write starting position; obtaining a multiplexer address of the device and a channel of the multiplexer, reading and writing step length data along the channel of the multiplexer from the starting position; reassigning the starting position; if the starting position is greater than the device memory capacity after reassignment, emptying the register corresponding to the memory. Based on the device memory cleaning method, the application further provides a device memory cleaning system, device and storage medium. The application only needs to obtain the I2C bus connected by the device, the device address, the device memory capacity, the register mode, the multiplexer address and the channel, so that the device memory connected to the I2C bus can be emptied, whether the device is directly connected to the I2C bus or indirectly connected to the multiplexer through the multiplexer, and whether the register is single-byte or double-byte.
[0030] The application solves the problem that the traditional I2C tool can only read and write one register at a time and can only read and write single-byte represented registers, avoids the disadvantages that the IPMI tool fails to read and write at a time and needs a large amount of repeated reading and writing, and increases workload. The application can simply, efficiently and accurately empty the device memory connected to the I2C bus. BRIEF DESCRIPTION OF DRAWINGS
[0031] As Figure 1 FIG. 1 is a flowchart of a device memory cleaning method in embodiment 1 of the application;
[0032] As Figure 2 FIG. 2 is a flowchart of cleaning after setting different step lengths in the device memory cleaning method in embodiment 1 of the application;
[0033] As Figure 3 FIG. 3 is a schematic diagram of a device memory cleaning system in embodiment 2 of the application. DETAILED DESCRIPTION
[0034] For purposes of clarity, the technology will be described with reference to the accompanying drawings. The disclosure provides a number of different embodiments or examples for implementing the various techniques described herein. Throughout the disclosure, specific examples of components and arrangements are described. Furthermore, examples of sequences of operations are described. These are presented herein for purposes of simplicity and clarity. It is not necessary to describe all combinations of components and operations. One of ordinary skill in the art will recognize that some implementations can be practiced without several of the components or steps described in the examples, and that the scope of the present technology is defined by the appended claims. The examples should not be understood as being limiting in any way.
[0035] Embodiment 1
[0036] The present application provides a device memory cleaning method, which solves the problem that the traditional I2C tool can only read and write one register at a time and can only read and write single-byte represented registers; at the same time, it avoids the disadvantages of IPMI tool single read and write failure and the need for a large number of repeated read and write, increasing the workload.
[0037] The method specifically comprises: obtaining first information of a device; the first information comprises an I2C bus to which the device is connected, a device address, and a device memory capacity;
[0038] After obtaining the first information of the device, the register mode corresponding to the device memory is judged, different step sizes are set according to the register mode, and then the read and write starting position is initialized;
[0039] The process of setting different step sizes according to different register modes comprises: when the mode of the register is byte, setting a first step size; when the mode of the register is word, setting a second step size; the first step size is set to 0x10; and the second step size is set to 0x80.
[0040] Obtaining a multiplexer address of the device and selecting a channel of the multiplexer, and reading and writing step size data along the channel of the multiplexer from the starting position;
[0041] The process of selecting the channel of the multiplexer comprises: calling an IPMI tool to select the channel of the multiplexer.
[0042] The process of reading and writing step size data from the starting position comprises calling an IPMI tool to read and write step size data from the starting position at a time.
[0043] Reassigning the starting position; if the starting position is greater than the device memory capacity after reassignment, the register corresponding to the memory is emptied. The process of emptying the register corresponding to the memory comprises writing 0xff into the register to empty the register corresponding to the memory.
[0044] AsFigure 1 A flow chart for setting different step lengths in a device memory cleaning method of embodiment 1 of the present application.
[0045] In step S100, the process is started.
[0046] In step S101, the user inputs information such as the I2C bus to which the device is connected, the device address, the device memory capacity, the register mode corresponding to the memory, the multiplexer address, and the multiplexer channel.
[0047] The register mode refers to whether it is represented by two bytes or one byte. If it is represented by two bytes, the word is input, and if it is represented by one byte, the byte is input.
[0048] In step S102, it is determined whether the user has input the I2C bus to which the device is connected, the device address, and the device memory capacity. If yes, step S103 is executed; if no, step S115 is executed.
[0049] In step S103, it is determined whether the user has input the register mode. If yes, step S105 is executed; if no, step S104 is executed.
[0050] In step S104, the mode is set to byte.
[0051] In step S105, it is determined whether the mode input by the user is byte or word. If it is byte, step S106 is executed; if it is word, step S107 is executed.
[0052] In step S106, if it is byte, the read / write step length is set to 0x10.
[0053] In step S107, if it is word, the read / write step length is set to 0x80.
[0054] In step S108, the read / write start position is set to 0.
[0055] As Figure 2 A flow chart for cleaning after setting different step lengths in a device memory cleaning method of embodiment 1 of the present application; after the flow chart as Figure 1 is executed, the flow chart as Figure 2 is continued to be executed.
[0056] In step S109, it is determined whether the user has input the multiplexer address and selected the multiplexer channel. If yes, step S110 is executed; if no, step S111 is executed.
[0057] In step S110, according to the input parameters, the IPMI tool is called to select the channel of the multiplexer;
[0058] In step S111, according to the input parameters, the IPMI tool is called to read and write the step length data from the starting position at one time;
[0059] In step S112, it is judged whether the reading and writing are successful; if yes, step S113 is executed, otherwise, step S111 is returned;
[0060] In step S113, the starting position is re-assigned;
[0061] In step S114, it is judged whether the starting position is greater than the memory size; if yes, step S115 is executed, otherwise, step S111 is returned;
[0062] In step S115, the reading and writing are successful. Writing 0xff into the register means clearing the register, and writing 0xff into all registers in the memory means clearing the memory.
[0063] The method for clearing the device memory provided in Embodiment 1 of the present application only needs to obtain the I2C bus connected by the device, the device address, the device memory capacity, the register mode, the address of the multiplexer and the channel, and then the memory of the device connected to the I2C bus can be cleared, whether the device is directly connected to the I2C bus or indirectly connected to the multiplexer through the multiplexer, and whether the register is single-byte or double-byte.
[0064] The method for clearing the device memory provided in Embodiment 1 of the present application solves the problem that the traditional I2C tool can only read and write one register at one time and can only read and write the single-byte register, and avoids the disadvantages of the IPMI tool single-time reading and writing failure and the need for a large number of repeated reading and writing to increase the workload. The present application can simply, efficiently and accurately clear the memory of the device connected to the I2C bus.
[0065] Embodiment 2
[0066] Based on the method for clearing the device memory provided in Embodiment 1 of the present application, Embodiment 2 of the present application further provides a system for clearing the device memory, like Figure 3 A schematic diagram of the system for clearing the device memory according to Embodiment 2 of the present application is shown in the figure, which comprises an acquisition module, a judgment module, a selection module and a clearing module;
[0067] The acquisition module is used for acquiring the first information of the device; the first information comprises the I2C bus connected by the device, the device address and the device memory capacity;
[0068] The judging module is used for judging the register mode corresponding to the device memory after obtaining the first information of the device, setting different step lengths according to the register mode, and then initializing the read-write starting position.
[0069] The selecting module is used for obtaining the multiplexer address of the device and selecting the channel of the multiplexer, and reading and writing step length data along the channel of the multiplexer from the starting position.
[0070] The clearing module is used for reassigning the starting position, and clearing the register corresponding to the memory if the starting position is greater than the capacity of the device memory after the reassignment.
[0071] In the judging module, the register mode corresponding to the device memory is judged after obtaining the first information of the device, different step lengths are set according to different register modes, and then the read-write starting position is initialized.
[0072] The process of setting different step lengths according to different register modes includes: setting a first step length when the register mode is byte, and setting a second step length when the register mode is word; the first step length is set to 0x10; and the second step length is set to 0x80.
[0073] In the selecting module, the process of selecting the channel of the multiplexer includes: calling the IPMI tool to select the channel of the multiplexer.
[0074] The process of reading and writing step length data from the starting position includes calling the IPMI tool to read and write step length data from the starting position at a time.
[0075] In the clearing module, the process of clearing the register corresponding to the memory includes writing 0xff into the register to clear the register corresponding to the memory.
[0076] The system for cleaning the device memory provided in Embodiment 2 of the present application only needs to obtain the I2C bus to which the device is connected, the device address, the device memory capacity, the register mode, the address and the channel of the multiplexer, and can clear the device memory connected to the I2C bus, whether the device is directly connected to the I2C bus or indirectly connected to the multiplexer through the multiplexer, and whether the register is single-byte or double-byte.
[0077] The system for cleaning the device memory provided in Embodiment 2 of the present application solves the problem that the traditional I2C tool can only read and write one register at a time and can only read and write the register represented by single byte, and avoids the disadvantages of single-time read-write failure of the IPMI tool and the need for a large amount of repeated read-write and increased workload. The present application can simply, efficiently and accurately clear the device memory connected to the I2C bus.
[0078] Embodiment 3
[0079] The application also provides a device comprising:
[0080] a memory for storing a computer program;
[0081] a processor for implementing the method steps when executing the computer program as follows:
[0082] obtaining first information of the device; the first information comprises an I2C bus to which the device is connected, a device address and a device memory capacity;
[0083] After obtaining the first information of the device, judging a register mode corresponding to the device memory, setting different step lengths according to different register modes, and then initializing a read-write starting position;
[0084] The process of setting different step lengths according to the register mode comprises: setting a first step length when the register mode is byte; setting a second step length when the register mode is word; the first step length is set as 0x10; and the second step length is set as 0x80.
[0085] obtaining a multiplexer address of the device and selecting a channel of the multiplexer, and reading and writing step length data from the starting position along the channel of the multiplexer;
[0086] The process of selecting the channel of the multiplexer comprises: calling an IPMI tool to select the channel of the multiplexer.
[0087] The process of reading and writing step length data from the starting position comprises calling an IPMI tool to read and write step length data from the starting position at one time.
[0088] reassigning the starting position; if the starting position is greater than the device memory capacity after reassignment, emptying the register corresponding to the memory; the process of emptying the register corresponding to the memory comprises writing 0xff into the register to empty the register corresponding to the memory.
[0089] As Figure 1 A flow chart for setting different step lengths in the method for cleaning a device memory according to Embodiment 1 of the application.
[0090] In step S100, the process is started;
[0091] In step S101, a user inputs information such as an I2C bus to which a device is connected, a device address, a device memory capacity, a register mode corresponding to a memory, a multiplexer address and a multiplexer channel of the device;
[0092] Wherein the register mode refers to whether it is represented by two bytes or one byte, if the input word is represented by two bytes, if it is represented by one byte, the input byte.
[0093] In step S102, it is determined again whether the user inputs the I2C bus connected by the device, the device address and the device memory capacity; it is judged whether the user inputs the I2C bus connected by the device, the device address and the device memory capacity, if yes, step S103 is executed, if no, step S115 is executed;
[0094] In step S103, it is judged whether the user inputs the register mode; if yes, step S105 is executed, otherwise, step S104 is executed;
[0095] In step S104, the mode is set as byte;
[0096] In step S105, it is judged whether the mode input by the user is byte or word; if it is byte, step S106 is executed, otherwise, step S107 is executed.
[0097] In step S106, if it is byte, the read-write step is set as 0x10;
[0098] In step S107, if it is word, the read-write step is set as 0x80;
[0099] In step S108, the read-write starting position is set as 0.
[0100] As Figure 2 is a flow chart of the method for cleaning the device memory in embodiment 1 of the present application; after the flow as Figure 1 is executed, the flow as Figure 2 is continued to be executed.
[0101] In step S109, it is judged whether the user inputs the multiplexer address and selects the channel of the multiplexer, if yes, step S110 is executed, otherwise, step S111 is executed;
[0102] In step S110, according to the input parameter, the channel of the multiplexer is selected by calling the IPMI tool;
[0103] In step S111, according to the input parameter, the IPMI tool is called to read and write the data of the read-write step from the starting position at one time;
[0104] In step S112, it is judged whether it is successful; if the read and write are successful, step S113 is executed, otherwise, step S111 is returned;
[0105] In step S113, the start position is re-assigned;
[0106] In step S114, it is read and written whether the start position is greater than the memory size; if yes, step S115 is executed, otherwise, step S111 is returned;
[0107] In step S115, it is indicated that the read and write are successful. Writing 0xff into the register means to empty the register, and writing 0xff into all registers in the memory means to empty the memory.
[0108] The device provided in embodiment 3 of the present application only needs to acquire the I2C bus connected with the device, the device address, the device memory capacity, the register mode, the address of the multiplexer and the channel, and the memory of the device connected with the I2C bus can be emptied, whether the device is directly connected with the I2C bus or indirectly connected with the multiplexer through the multiplexer, and whether the register is single-byte or double-byte.
[0109] The device provided in embodiment 3 of the present application solves the problem that the traditional I2C tool can only read and write one register at a time and can only read and write the single-byte represented register, and avoids the disadvantages of the IPMI tool single read and write failure and the need for a large number of repeated read and write to increase the workload. The present application can simply, efficiently and accurately empty the memory of the device connected with the I2C bus.
[0110] It should be noted that the technical scheme of the present application also provides an electronic device, which comprises: a communication interface capable of interacting with other devices such as network devices; a processor connected with the communication interface to realize information interaction with other devices, used to run a computer program to execute the method for cleaning the device memory provided by one or more technical schemes, and the computer program is stored in the memory. Of course, in actual application, various components in the electronic device are coupled together through a bus system. It can be understood that the bus system is used to realize the connection and communication between the components. In addition to the data bus, the bus system also includes a power bus, a control bus and a state signal bus. The memory in the embodiment of the present application is used to store various types of data to support the operation of the electronic device. Examples of these data include: any computer program used to operate on the electronic device. It can be understood that the memory can be a volatile memory or a non-volatile memory, and can also include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM, Read-Only Memory), a programmable read-only memory (PROM, Programmable Read-Only Memory), an erasable programmable read-only memory (EPROM, Erasable Programmable Read-Only Memory), an electrically erasable programmable read-only memory (EEPROM, Electrically Erasable Programmable Read-Only Memory), a ferromagnetic random access memory (FRAM, ferromagnetic random access memory), a flash memory (Flash Memory), a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM, Compact Disc Read-Only Memory); the magnetic surface memory can be a disk memory or a tape memory. The volatile memory can be a random access memory (RAM, Random Access Memory) used as an external cache.By way of example and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), SyncLink Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM). The memory described in embodiments of the present application is intended to include, but not be limited to, these and any other suitable types of memory. The methods disclosed in embodiments of the present application can be applied in or implemented by a processor. The processor can be an integrated circuit chip
[0111] Embodiment 4
[0112] The application further provides a readable storage medium, wherein the readable storage medium stores a computer program, and the computer program is executed by a processor to implement the following method steps:
[0113] The first information of the device is acquired; the first information comprises an I2C bus connected by the device, a device address and a device memory capacity;
[0114] After the first information of the device is acquired, the register mode corresponding to the device memory is judged, different step lengths are set according to different register modes, and then the starting position of reading and writing is initialized;
[0115] The process of setting different step lengths according to the register mode comprises: setting a first step length when the register mode is byte; setting a second step length when the register mode is word; the first step length is set as 0x10; and the second step length is set as 0x80.
[0116] The multiplexer address of the device is acquired, the channel of the multiplexer is selected, and step length data is read and written from the starting position along the channel of the multiplexer;
[0117] The process of selecting the channel of the multiplexer comprises: calling an IPMI tool to select the channel of the multiplexer.
[0118] The process of reading and writing step length data from the starting position comprises: calling an IPMI tool to read and write step length data from the starting position at one time.
[0119] The starting position is re-assigned; if the starting position is greater than the device memory capacity after the re-assignment, the register corresponding to the memory is emptied. The process of emptying the register corresponding to the memory comprises: writing 0xff into the register to empty the register corresponding to the memory.
[0120] As Figure 1 A flow chart for setting different step lengths in the device memory cleaning method of the embodiment 1 of the application.
[0121] In step S100, the process is started;
[0122] In step S101, the user inputs the information of the I2C bus connected by the device, the device address, the device memory capacity, the register mode corresponding to the memory, the multiplexer address and the multiplexer channel and the like;
[0123] The register mode refers to whether two bytes are used for representation or one byte is used for representation; if two bytes are used for representation, word is inputted, and if one byte is used for representation, byte is inputted.
[0124] In step S102, it is determined whether the user inputs the I2C bus to which the device is connected, the device address and the device memory capacity; if yes, step S103 is executed; if no, step S115 is executed.
[0125] In step S103, it is determined whether the user inputs the register mode; if yes, step S105 is executed; otherwise, step S104 is executed.
[0126] In step S104, the mode is set as byte.
[0127] In step S105, it is determined whether the mode input by the user is byte or word; if byte, step S106 is executed; otherwise, step S107 is executed.
[0128] In step S106, if byte, the read-write step length is set as 0x10.
[0129] In step S107, if word, the read-write step length is set as 0x80.
[0130] In step S108, the read-write start position is set as 0.
[0131] As Figure 2 is a flowchart of a method for cleaning a device memory according to an embodiment of the present application; after the flowchart as Figure 1 is executed, the flowchart as Figure 2 is continued to be executed.
[0132] In step S109, it is determined whether the user inputs the multiplexer address and selects the channel of the multiplexer; if yes, step S110 is executed; otherwise, step S111 is executed.
[0133] In step S110, the IPMI tool is called to select the channel of the multiplexer according to the input parameters.
[0134] In step S111, the IPMI tool is called to read and write the data of the read-write step length from the start position at one time according to the input parameters.
[0135] In step S112, it is determined whether the reading and writing are successful; if yes, step S113 is executed; otherwise, step S111 is returned.
[0136] In step S113, the start position is re-assigned.
[0137] In step S114, it is determined whether the read-write start position is greater than the memory size; if yes, step S115 is executed; otherwise, step S111 is returned.
[0138] In step S115, it is indicated that the reading and writing is successful. Writing 0xff into the register means clearing the register, and writing 0xff into all registers in the memory means clearing the memory.
[0139] The storage medium provided in the embodiment 4 of the present application only needs to acquire the I2C bus connected with the device, the device address, the device memory capacity, the register mode, the address of the multiplexer and the channel, and the memory of the device connected with the I2C bus can be cleared, whether the device is directly connected with the I2C bus or indirectly connected with the multiplexer through the multiplexer, and whether the register is single byte or double byte.
[0140] The storage medium provided in the embodiment 4 of the present application solves the problem that the traditional I2C tool can only read and write one register at a time and can only read and write the register represented by single byte, and avoids the disadvantages of the IPMI tool single reading and writing failure and the need for a large number of repeated reading and writing to increase the workload. The present application can simply, efficiently and accurately clear the memory of the device connected with the I2C bus.
[0141] The embodiment of the present application also provides a storage medium, that is, a computer storage medium, specifically a computer readable storage medium, for example, a memory for storing a computer program, and the computer program can be executed by a processor to complete the steps of the foregoing method. The computer readable storage medium can be FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc or CD-ROM memory.
[0142] Those skilled in the art can understand that all or part of the steps of the above-mentioned method embodiments can be completed by program instruction related hardware, and the foregoing program can be stored in a computer readable storage medium, and the program performs the steps of the above-mentioned method embodiments when executed; and the foregoing storage medium includes: mobile storage equipment, ROM, RAM, magnetic disc or optical disc and various storage program codes. Or, the integrated units of the present application can be stored in a computer readable storage medium if they are realized in the form of software function modules and sold or used as independent products. Based on such understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products, which are stored in a storage medium and include a plurality of instructions for causing an electronic device (which can be a personal computer, a server, or a network device) to execute all or part of the methods described in the embodiments of the present application. The foregoing storage medium includes: mobile storage equipment, ROM, RAM, magnetic disc or optical disc and various storage program codes.
[0143] The description of the related part in the storage medium and the processing device provided by the embodiments of the present application can refer to the detailed description of the corresponding part in the method for cleaning the device memory provided by the embodiments of the present application, which will not be repeated here.
[0144] It should be noted that, in this paper, relationship terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device inherent to the series of elements. Without more limitation, the element defined by the sentence "including a…" does not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, the above technical solutions provided by the embodiments of the present application are not described in detail, which are consistent with the implementation principles of the corresponding technical solutions in the prior art, so as not to be too repetitive.
[0145] The above describes the specific embodiments of the present application in combination with the drawings, but is not a limitation on the protection scope of the present application. Based on the above description, those skilled in the art can make other different forms of modifications or changes. Here, it is not necessary or impossible to exhaust all the embodiments. Various modifications or changes made by those skilled in the art on the basis of the technical solutions of the present application without creative labor are still within the protection scope of the present application.
Claims
1. A method of device memory cleaning, characterized by, The method comprises the following steps: acquiring first information of the device; the first information comprises an I2C bus to which the device is connected, a device address, and a device memory capacity; after acquiring the first information of the device, judging a register mode corresponding to the device memory, setting different step lengths according to the register mode, and then initializing a read-write starting position; acquiring a multiplexer address of the device and selecting a channel of the multiplexer, and reading and writing step lengths of data from the starting position along the channel of the multiplexer; reassigning the starting position; if the starting position is greater than the device memory capacity after reassignment, emptying the register corresponding to the memory.
2. The method of device memory cleaning of claim 1, wherein, The process of setting different step lengths according to the register mode comprises: when the mode of the register is byte, setting a first step length; when the mode of the register is word, setting a second step length.
3. A method of device memory cleaning according to claim 2, wherein, The first step length is set to 0x10; and the second step length is set to 0x80.
4. The method of device memory cleaning of claim 1, wherein, The process of selecting the channel of the multiplexer comprises: calling an IPMI tool to select the channel of the multiplexer.
5. The method of device memory cleaning of claim 1, wherein, The process of reading and writing step lengths of data from the starting position comprises: calling the IPMI tool to read and write step lengths of data from the starting position at one time.
6. The method of device memory cleaning of claim 1, wherein, The process of emptying the register corresponding to the memory comprises: writing 0xff into the register to empty the register corresponding to the memory.
7. A system for device memory cleaning, characterized by The method comprises an acquiring module, a judging module, a selecting module, and an emptying module; The acquiring module is used to acquire first information of the device; the first information comprises an I2C bus to which the device is connected, a device address, and a device memory capacity; The judging module is used to, after acquiring the first information of the device, judge a register mode corresponding to the device memory, set different step lengths according to the register mode, and then initialize a read-write starting position; The selecting module is used to acquire a multiplexer address of the device and select a channel of the multiplexer, and read and write step lengths of data from the starting position along the channel of the multiplexer; The emptying module is used to reassign the starting position; if the starting position is greater than the device memory capacity after reassignment, empty the register corresponding to the memory.
8. A system for device memory cleaning according to claim 7, wherein, The process executed by the emptying module comprises: writing 0xff into the register to empty the register corresponding to the memory.
9. An apparatus, comprising: The method comprises: a memory for storing a computer program; a processor for executing the computer program to implement the method steps of any one of claims 1 to 6.
10. A readable storage medium, characterized by, A computer program is stored on the readable storage medium, and the computer program is executed by the processor to implement the method steps of any one of claims 1 to 6.
Citation Information
Patent Citations
Communication method and device of internal integrated circuit host
CN108280041A
Memory expansion method and apparatus in a virtual memory system
US5317706A