A small log storage method based on EEPROM, a smart terminal and a storage medium
Patent Information
- Application Number
- CN202310462621.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-22
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2043-04-22
AI Technical Summary
[0003]由此申请人认为,在使用Easylog进行EEPROM存储操作时,需要进行多层调用,这种多层调用会导致EEPROM存储的效率低
1.通过将日志存储流程封装于EPPROM驱动中,即可在写日志状态时通过EEPROM驱动即可调用日志存储流程,完成将日志数据写入EEPROM的步骤,从而与现有的日志记录工具相比,无需进行多层调用,有效提高了EEPROM存储的效率;除此之外,将队列缓冲区中积累的日志数据按照定量的策略即在数据长度达到预设的长度阈值时写入EEPROM中,可有效避免每次日志数据的写入操作的创建,更有利于提高EEPROM存储的效率。
Smart Images

Figure CN116483277B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of log recording, and in particular to a small log storage method based on EEPROM, a smart terminal, and a storage medium. Background Technology
[0002] EEPROM stands for Electrically Erasable Programmable Read-Only Memory, used for recording log data. Current logging uses the Easylog logging tool. When Easylog performs storage operations on the EEPROM hardware, it requires multiple layers of software interface calls. Specifically, the Easylog tool calls the Easy Flash module, the Serial Flash Universal Driver module, and the ST hal SPI driver module to complete the EEPROM storage operations. The EasyFlash module and the Serial Flash Universal Driver module are hardware acceleration modules used to improve disk read / write performance, while the ST hal SPI driver module is a hardware driver module used to install and run devices that interface with ST-link, such as disks, USB ports, and graphics cards.
[0003] Therefore, the applicant believes that when using Easylog for EEPROM storage operations, multiple layers of calls are required, which leads to low efficiency in EEPROM storage. Summary of the Invention
[0004] To effectively improve the efficiency of EEPROM storage, this application provides a small-scale log storage method based on EEPROM, an intelligent terminal, and a storage medium.
[0005] Firstly, the small-scale log storage method based on EEPROM provided in this application adopts the following technical solution: A small-scale log storage method based on EEPROM includes: Check the length of the log data in the queue buffer; When the data length reaches a preset length threshold, the system enters log reading mode and reads the log data. Exit the log read state and enter the log write state, writing the log data to the EEPROM through the log storage process encapsulated in the EEPROM driver.
[0006] By adopting the above technical solution, and by encapsulating the log storage process in the EEPROM driver, the log storage process can be called through the EEPROM driver when writing logs, thus completing the step of writing log data to EEPROM. Compared with existing log recording tools, this eliminates the need for multi-level calls and effectively improves the efficiency of EEPROM storage. In addition, writing the accumulated log data in the queue buffer into the EEPROM according to a quantitative strategy, i.e., when the data length reaches a preset length threshold, can effectively avoid the creation of each log data write operation, which is more conducive to improving the efficiency of EEPROM storage.
[0007] Optionally, the log storage process includes: Determine the current target page in the EEPROM and the current operating page number of the current target page; Based on the current operation page number, the log data is written to the EEPROM.
[0008] By adopting the above technical solution, the log storage process is used to write log data into EPPROM, and the writing of log data into EEPROM is implemented based on the log storage process.
[0009] Optionally, the EEPROM includes a first disk allocation area and a second disk allocation area; The step of writing the log data to the EEPROM based on the current operation page number includes: Change the operation status of the status byte content corresponding to the operation page number in the first disk allocation area from the modified status to the write status. Write the log data to the current target page, and change the operation status of the status byte content corresponding to the operation page number in the first disk allocation area from the write status to the full status. Change the length flag in the second disk allocation area corresponding to the operation page number from the never-written flag to the full flag; the length flag is used to identify the length of the current target page corresponding to the operation page number; Change the operation status of the status byte content corresponding to the operation page number in the first disk allocation area from the full state to the available state; the available state is used to indicate that the log data of the current target page corresponding to the operation page number is available.
[0010] By adopting the above technical solution, the operation page number is used to determine the current target page for writing log data. When writing log data to EEPROM, the first disk allocation area is used to determine the operation status of the status byte content corresponding to the operation page number, and the second disk allocation area is used to determine the length of the current target page. Log data can be stored through the first disk allocation area and the second disk allocation area.
[0011] Optionally, before writing the log data to the EEPROM through the log storage process encapsulated in the EEPROM driver, the following steps are included: Check whether the first disk allocation area and the second disk allocation area meet the preset erasure conditions; If the erasure conditions are met, erase operations are performed on the first disk allocation area and the second disk allocation area.
[0012] By adopting the above technical solution, since EEPROM only allows writing after erasure, it is necessary to check whether the first disk allocation area and the second disk allocation area need to be erased before writing log data to EEPROM.
[0013] Optionally, before exiting the log read state and entering the log write state, and writing the log data to the EEPROM through the log storage process encapsulated in the EEPROM driver, the method further includes: Real-time power supply voltage detection; When the power supply voltage is less than a preset voltage threshold, the log writing state is terminated. Enable write protection mechanism for EEPROM.
[0014] By adopting the above technical solution, in order to effectively reduce the probability of log data loss when the voltage is low, a voltage protection mechanism is added, that is, when the power supply voltage is less than the voltage threshold, the write protection mechanism of the EEPROM is activated.
[0015] Optionally, the write protection mechanism for starting the EEPROM includes: Create a copy of the log data to be written, obtain the copy log data, and save it; When the power supply voltage is not less than the voltage threshold, determine whether the log data to be written has been lost; If lost, the write log state is activated, and the replica log data is written to the EEPROM.
[0016] By adopting the above technical solution, when the power supply voltage is less than the voltage threshold, a copy of the log data is created, which effectively reduces the probability of log data loss. In the event of log data loss, the copy of the log data can be written to the EEPROM, thereby effectively protecting the log data.
[0017] Optionally, after exiting the log read state and entering the log write state, and writing the log data to the EEPROM through the log storage process encapsulated in the EEPROM driver, the process includes: Determine whether all the log data in the queue buffer has been written to the EEPROM; If all the log data in the queue buffer is written to the EPPROM, then the shutdown state is initiated.
[0018] By adopting the above technical solution, the system is put into shutdown mode when all log data is written to EEPROM, thereby effectively reducing the probability of EEPROM disk failure.
[0019] Secondly, the smart terminal provided in this application adopts the following technical solution: A smart terminal includes a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor loads and executes the computer program, it employs the aforementioned small log storage method based on EEPROM.
[0020] By adopting the above technical solution, a computer program is generated by the above-mentioned EEPROM-based small log storage method and stored in the memory for loading and execution by the processor. Thus, a smart terminal is made based on the memory and processor, which is convenient to use.
[0021] Thirdly, the computer-readable storage medium provided in this application adopts the following technical solution: A computer-readable storage medium storing a computer program, wherein the computer program, when loaded and executed by a processor, employs the aforementioned small log storage method based on EEPROM.
[0022] By adopting the above technical solution, a computer program is generated by the above EEPROM-based small log storage method and stored in a computer-readable storage medium for loading and execution by the processor. The computer-readable storage medium facilitates the reading and storage of the computer program.
[0023] In summary, this application has at least one of the following beneficial technical effects: 1. By encapsulating the log storage process within the EEPROM driver, the log storage process can be invoked directly through the EEPROM driver during log writing to complete the step of writing log data to the EEPROM. Compared with existing logging tools, this eliminates the need for multi-level calls, effectively improving the efficiency of EEPROM storage. In addition, writing the accumulated log data in the queue buffer into the EEPROM according to a quantitative strategy—that is, when the data length reaches a preset length threshold—effectively avoids the creation of the EEPROM for each log data write operation, further enhancing the efficiency of EEPROM storage.
[0024] 2. Add a voltage protection mechanism, that is, when the power supply voltage is lower than the voltage threshold, the write protection mechanism of EEPROM is activated, which effectively reduces the probability of log data loss when the voltage is low.
[0025] 3. When the power supply voltage is less than the voltage threshold, a copy of the log data is created, which effectively reduces the probability of log data loss. In the event of log data loss, the copy of the log data can be written to the EEPROM, thereby effectively protecting the log data. Attached Figure Description
[0026] Figure 1 This is a flowchart illustrating one embodiment of a small log storage method based on EEPROM according to an embodiment of this application.
[0027] Figure 2 This is a flowchart illustrating one embodiment of a small log storage method based on EEPROM according to an embodiment of this application.
[0028] Figure 3 This is a flowchart illustrating one embodiment of a small log storage method based on EEPROM according to an embodiment of this application.
[0029] Figure 4 This is a flowchart illustrating one embodiment of a small log storage method based on EEPROM according to an embodiment of this application.
[0030] Figure 5 This is a flowchart illustrating one embodiment of a small log storage method based on EEPROM according to an embodiment of this application.
[0031] Figure 6 This is a flowchart illustrating one embodiment of a small log storage method based on EEPROM according to an embodiment of this application.
[0032] Figure 7 This is a flowchart illustrating one embodiment of a small log storage method based on EEPROM according to an embodiment of this application. Detailed Implementation
[0033] The following is in conjunction with the appendix Figures 1 to 7 This application will be described in further detail.
[0034] This application discloses a small log storage method based on EEPROM.
[0035] Reference Figure 1 A small-scale log storage method based on EEPROM includes the following steps: S101. Check the length of log data in the queue buffer.
[0036] A queue buffer is a database structure used to organize log data into several queues, with each queue containing log data of the same length. In distributed systems, message queues are typically used to transmit data, i.e., log data is transmitted through queue buffers, which effectively avoids duplicate data transmission and improves data processing efficiency.
[0037] The unit of log data length is bytes. That is, if the log data occupies 2 bytes, then the data length is 2 bytes.
[0038] S102. When the data length reaches the preset length threshold, enter the log reading state and read the log data.
[0039] The length threshold is preset. In this embodiment, the length threshold is 256 bytes. That is, when the data length is 256 bytes, the system enters the log read state and reads the log data. Specifically, in the log read state, every 10ms, the system checks whether there is 256 bytes of log data in the queue buffer. If there is 256 bytes of data, the system retrieves the 256 bytes of data, then exits the log read state and enters the log write state.
[0040] S103. Exit the log reading state and enter the log writing state. Write log data to EEPROM through the log storage process encapsulated in the EEPROM driver.
[0041] The read log status is used to indicate the current execution status of reading log data. Similarly, the write log status is used to indicate the current execution status of writing log data to EPPROM. It should be noted that the write log status cannot be performed while the read log status is active.
[0042] The log storage process involves writing log data to the EEPROM, specifically encapsulated in code within the EEPROM driver. The EEPROM driver is a program or software that implements EEPROM read and write operations, facilitating data transfer between the computer system and the EEPROM. Specifically, in log writing mode, log data can be written to the EEPROM through the log storage process encapsulated in the EEPROM driver, eliminating the need to call multiple interface programs and thus effectively improving EEPROM storage efficiency.
[0043] The implementation principle of this embodiment is as follows: by encapsulating the log storage process in the EEPROM driver, the log storage process can be called through the EEPROM driver when writing logs, and the step of writing log data to EEPROM can be completed. Therefore, compared with existing log recording tools, there is no need to perform multi-level calls, which effectively improves the efficiency of EEPROM storage. In addition, writing the accumulated log data in the queue buffer into the EEPROM according to a quantitative strategy, i.e., when the data length reaches a preset length threshold, can effectively avoid the creation of each log data write operation, which is more conducive to improving the efficiency of EEPROM storage.
[0044] In one embodiment of this example, refer to Figure 2 The log storage process includes the following steps: S201. Determine the current target page and the current operation page number of the current target page in the EEPROM.
[0045] The operation page number is an identifier used to represent a page number, also known as CruPageID. Typically, CruPageID is used to record the page number of a specific data page, indicating the position of the page currently in use in the database. Specifically, the steps to determine the current target page in the EEPROM are as follows: 1. Starting from the preset start address of the EEPROM, scan the status bytes of each page in the EEPROM to find free pages; When the status byte is 0x00, it indicates that the page is an empty page.
[0046] 2. If an empty page is found, check if any of its adjacent pages are already filled with data. If so, skip the empty page and continue scanning the next page; otherwise, the empty page is the current target page.
[0047] 3. If no usable page is found after scanning all pages, return to the first page and continue scanning until the entire EEPROM has been scanned.
[0048] Once the target page is located, the operation page number (CurPageID) can be determined, which is the operation page number of the current target page. When writing data, the data is simply written to the data area corresponding to the current target page.
[0049] S202. Write log data to EEPROM based on the current operation page number.
[0050] Knowing the operation page number, log data can be written to the current target page in the EEPROM corresponding to the operation page number.
[0051] The small log storage method based on EEPROM provided in this embodiment uses a log storage process to write log data into EEPROM, and the writing of log data into EEPROM is implemented based on the log storage process.
[0052] In one embodiment of this example, refer to Figure 3 EEPROM includes a first disk allocation area and a second disk allocation area; Based on the current operation page number, write log data to EEPROM, including the following steps: S301. Change the operation status of the status byte content corresponding to the operation page number in the first disk allocation area from the modified status to the write status.
[0053] The first disk allocation area refers to the LAT1 area, and the second disk allocation area refers to the LAT0 area. Specifically, the LAT1 area is used to manage the data structure of the physical address, status information, and other metadata of data pages. The LAT0 area is also used to manage data pages in the database buffer. Unlike the LAT1 area, the LAT0 area is used to manage the length of each data page. The length of a data page refers to the length of the log data within the data page.
[0054] The status byte content is represented by a numerical encoding. For example, a status byte content of 0xff indicates that the target page corresponding to the operation page number is not in use, and a status byte content of 0x3f indicates that the target page corresponding to the operation page number has started writing data. Correspondingly, when the operation status of the status byte content is modified, the status byte content is 0xff, and when the operation status of the status byte content is written, the status byte content is 0x3f.
[0055] Changing the operation status from modified to write indicates that the current target page corresponding to the operation page number is ready to be written.
[0056] S302. Write the log data to the current target page, and change the operation status of the status byte content corresponding to the operation page number in the first disk allocation area from the write status to the full status.
[0057] When the current target page is writable, the log data is written to the current target page, and the operation status of the status byte content corresponding to the operation page number in the first disk allocation area is changed from the write status to the full status. The status byte content corresponding to the full status is 0x0f, indicating that the current target page is full of log data.
[0058] S303. Change the length flag corresponding to the operation page number in the second disk allocation area from the never-written flag to the full flag; the length flag is used to identify the length of the current target page corresponding to the operation page number.
[0059] After the current target page is filled with log data, the length flag corresponding to the operation page number in the second disk allocation area is changed from the "never written" flag to the "full" flag. The length flag corresponding to the "full" flag is 0x00, and the length flag corresponding to the "never written" flag is 0xff. Changing the "never written" flag to the "full" flag indicates that the current target page is filled with log data.
[0060] S304. Change the operation status of the status byte content corresponding to the operation page number in the first disk allocation area from the full state to the available state; the available state is used to indicate that the log data of the current target page corresponding to the operation page number is available.
[0061] The status byte content corresponding to the available status is 0x03, indicating that the current target page can be retrieved and read, that is, the log data used to identify the current target page corresponding to the operation page number is available.
[0062] The small log storage method based on EEPROM provided in this embodiment uses the operation page number to determine the current target page for writing log data. When writing log data to EEPROM, the first disk allocation area is used to determine the operation status of the status byte content corresponding to the operation page number, and the second disk allocation area is used to determine the length of the current target page. Log data storage can be achieved through the first disk allocation area and the second disk allocation area.
[0063] In one embodiment of this example, refer to Figure 4 Before writing log data to the EEPROM through the log storage process encapsulated in the EEPROM driver, the following steps are included: S401. Check whether the first disk allocation area and the second disk allocation area meet the preset erasure conditions.
[0064] In this embodiment, the erasure conditions include Block erasure conditions and Sector erasure conditions. Block erasure refers to block erasure. Sector erasure refers to sector erasure. The erasure conditions are erasure instructions, which are preset by the user. For example, if the operation page number 0x2ff is filled, the Block erasure is executed when the operation page number 0x2ff is filled.
[0065] S402. If the erasure conditions are met, perform an erasure operation on the first disk allocation area and the second disk allocation area.
[0066] If the erase condition is triggered, the corresponding disk allocation area will be erased based on the erase condition.
[0067] The small log storage method based on EEPROM provided in this embodiment requires checking whether the first disk allocation area and the second disk allocation area need to be erased before writing log data to the EEPROM, since the EEPROM only allows writing after erasure.
[0068] In one embodiment of this example, refer to Figure 5 Before exiting the log read state and entering the log write state, and writing log data to the EEPROM through the log storage process encapsulated in the EEPROM driver, the following steps are also included: S501, Real-time detection of power supply voltage.
[0069] The power supply voltage is detected by preset monitoring software. In addition to detecting the power supply voltage, the monitoring software can also detect power and other parameters.
[0070] S502. When the power supply voltage is less than the preset voltage threshold, terminate the log writing state.
[0071] When the power supply voltage is lower than the voltage threshold, it indicates that the voltage condition is abnormal and may cause a power outage, affecting the writing of log data to the EPPROM. At this time, the log writing state is terminated, thereby effectively reducing the probability of data loss when the voltage condition is abnormal.
[0072] S503, Enable the write protection mechanism of EEPROM.
[0073] In addition to terminating the write log state to protect log data, the write protection mechanism of EEPROM is also activated to prevent abnormal situations such as data loss, such as creating a data copy or storing the log data in another buffer.
[0074] In order to effectively reduce the probability of log data loss when the voltage is low, the small log storage method based on EEPROM provided in this embodiment adds a voltage protection mechanism, that is, when the power supply voltage is less than the voltage threshold, the write protection mechanism of EEPROM is activated.
[0075] In one embodiment of this example, refer to Figure 6 To enable the write protection mechanism of the EEPROM, the following steps are required: S601. Create a copy of the log data to be written, obtain the copy log data, and save it.
[0076] In this embodiment, the write protection mechanism of the EPPROM involves creating a copy of the log data that has not yet been written, i.e., the log data to be written, and saving it. Specifically, the log data to be written can be copied and saved to another disk, i.e., a copy of the log data is created and saved.
[0077] S602. When the power supply voltage is not less than the voltage threshold, determine whether the log data to be written has been lost.
[0078] When the power supply voltage is not less than the voltage threshold, it indicates that the power supply voltage has returned to normal. At this time, it is possible to determine whether the log data to be written has been lost by checking whether there is log data in the buffer where the log data was located before the copy was saved.
[0079] S603. If lost, start writing log state and write the replica log data to EEPROM.
[0080] If the log data to be written is lost, the write log state is activated, and the log data of the established copy is written to the EPPROM.
[0081] If the log data to be written is not lost, delete the copy of the log data on another disk and write the log data to be written to the EPPROM.
[0082] The small log storage method based on EEPROM provided in this embodiment creates a copy of the log data when the power supply voltage is less than the voltage threshold, which effectively reduces the probability of log data loss. In the event of log data loss, the copied log data can be written to the EEPROM, thereby effectively protecting the log data.
[0083] In one embodiment of this example, refer to Figure 7 After exiting the log read state and entering the log write state, and writing the log data to the EEPROM through the log storage process encapsulated in the EEPROM driver, the following steps are included: S701. Determine whether all log data in the queue buffer has been written to EEPROM.
[0084] The system determines whether all log data in the queue buffer has been written to the EEPROM by checking whether there is still log data in the queue buffer.
[0085] S702. If all log data in the queue buffer is written to the EPPROM, then the power-off state is started.
[0086] If all log data in the queue buffer is written to the EEPROM, the power-off state is initiated. The power-off state refers to terminating the log data reading and writing states, thereby reducing the probability of EEPROM disk failure.
[0087] The small log storage method based on EEPROM provided in this embodiment starts the power-off state when all log data is written to EEPROM, thereby effectively reducing the probability of EEPROM disk failure.
[0088] This application also discloses a smart terminal, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor. When the processor executes the computer program, it employs the small log storage method based on EEPROM described in the above embodiments.
[0089] The smart terminal can be a computer device such as a desktop computer, a laptop computer, or a cloud server. The smart terminal includes, but is not limited to, a processor and a memory. For example, the smart terminal may also include input / output devices, network access devices, and buses.
[0090] The processor can be a central processing unit (CPU). Of course, depending on the actual use, it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), off-the-shelf programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor, etc., and this application does not limit it.
[0091] The memory can be an internal storage unit of the smart terminal, such as a hard disk or memory of the smart terminal, or an external storage device of the smart terminal, such as a plug-in hard disk, smart memory card (SMC), secure digital card (SD) or flash memory card (FC) equipped on the smart terminal. Furthermore, the memory can also be a combination of internal storage units and external storage devices of the smart terminal. The memory is used to store computer programs and other programs and data required by the smart terminal. The memory can also be used to temporarily store data that has been output or will be output. This application does not limit this.
[0092] In this smart terminal, the EEPROM-based small log storage method described in the above embodiments is stored in the smart terminal's memory and loaded and executed on the smart terminal's processor for convenient use.
[0093] This application also discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it employs the small log storage method based on EEPROM described in the above embodiments.
[0094] The computer program can be stored in a computer-readable medium. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or certain middleware. The computer-readable medium includes any entity or device capable of carrying computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the computer-readable medium includes, but is not limited to, the above-mentioned components.
[0095] The EEPROM-based small log storage method described in the above embodiments is stored in the computer-readable storage medium and loaded and executed on the processor to facilitate the storage and application of the above method.
[0096] The above are all preferred embodiments of this application and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.
Claims
1. A small-scale log storage method based on EEPROM, characterized in that, include: Check the length of the log data in the queue buffer; When the data length reaches a preset length threshold, the system enters log reading mode and reads the log data. The reading of the log data includes: checking whether the log data in the queue buffer has reached the length threshold at preset intervals; if it has, retrieving the corresponding length of log data and exiting the log reading state. Exit the log reading state and enter the log writing state. Write the log data to the EEPROM through the log storage process encapsulated in the EEPROM driver. The EEPROM driver is a program that implements EEPROM read and write operations. The log storage process is encapsulated in the EEPROM driver in code, so that in the log writing state, the EEPROM driver directly calls the log storage process to complete the writing without calling multiple interface programs. The log storage process includes: Determine the current target page in the EEPROM and the current operating page number of the current target page; Based on the current operation page number, write the log data into the EEPROM; EEPROM includes a first disk allocation area and a second disk allocation area; The step of writing the log data to the EEPROM based on the current operation page number includes: Change the operation status of the status byte content corresponding to the operation page number in the first disk allocation area from the modified status to the write status. Write the log data to the current target page, and change the operation status of the status byte content corresponding to the operation page number in the first disk allocation area from the write status to the full status. Change the length flag in the second disk allocation area corresponding to the operation page number from the never-written flag to the full flag; the length flag is used to identify the length of the current target page corresponding to the operation page number; Change the operation status of the status byte content corresponding to the operation page number in the first disk allocation area from the full state to the available state; the available state is used to indicate that the log data of the current target page corresponding to the operation page number is available.
2. The method for small-scale log storage based on EEPROM according to claim 1, characterized in that, Before writing the log data to the EEPROM through the log storage process encapsulated in the EEPROM driver, the process includes: Check whether the first disk allocation area and the second disk allocation area meet the preset erasure conditions; If the erasure conditions are met, erase operations are performed on the first disk allocation area and the second disk allocation area.
3. The method for small-scale log storage based on EEPROM according to claim 1, characterized in that, Before exiting the log read state and entering the log write state, and writing the log data to the EEPROM through the log storage process encapsulated in the EEPROM driver, the process further includes: Real-time power supply voltage detection; When the power supply voltage is less than a preset voltage threshold, the log writing state is terminated. Enable write protection mechanism for EEPROM.
4. The method for small-scale log storage based on EEPROM according to claim 3, characterized in that, The write protection mechanism for booting the EEPROM includes: Create a copy of the log data to be written, obtain the copy log data, and save it; When the power supply voltage is not less than the voltage threshold, determine whether the log data to be written has been lost; If lost, the write log state is activated, and the replica log data is written to the EEPROM.
5. A small-scale log storage method based on EEPROM according to claim 1, characterized in that, After exiting the log read state and entering the log write state, and writing the log data to the EEPROM through the log storage process encapsulated in the EEPROM driver, the process includes: Determine whether all the log data in the queue buffer has been written to the EEPROM; If all the log data in the queue buffer is written to the EPPROM, then the power-off state is initiated.
6. A smart terminal, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, characterized in that, When the processor loads and executes the computer program, it employs the method described in any one of claims 1 to 5.
7. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is loaded and executed by the processor, it employs the method described in any one of claims 1 to 5.
Citation Information
Patent Citations
Log recording method and related device
CN114253820A
EEPROM data storage protection control method, computer storage medium and vehicle
CN114490453A