Data read-write method of terminal, readable storage medium, program product and terminal
Patent Information
- Application Number
- CN202511161024.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-19
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2045-08-19
AI Technical Summary
由于Flash存储器的擦写寿命有限,通常为10万至100万次,频繁写入会加速Flash的磨损,导致Flash的坏块增多,最终可能使存储介质失效,从而引发数据损坏或设备故障
[0021] Compared with the prior art, the beneficial effects of this application are as follows: This application determines the mobile state of the terminal and determines the write strategy for writing at least some parameters in the NV data to at least some NV storage areas of the Flash based on the mobile state of the terminal. This allows the terminal to have a corresponding write strategy in different mobile states. Furthermore, since the write operation when writing at least some parameters to at least some NV storage areas of the Flash is at least partially triggered by a set trigger event, unnecessary write operations to the Flash can be reduced without affecting the terminal's business. This not only extends the lifespan of the Flash and prevents the terminal from prematurely failing due to storage failure, but also reduces device power consumption.
Smart Images

Figure CN120994137B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a data reading and writing method for a terminal, a readable storage medium, a program product, and a terminal. Background Technology
[0002] LTE Cat.1 (Category 1 of LTE terminals) is a terminal category defined in 4G LTE networks, specifically designed for low-to-medium speed IoT scenarios. It was first proposed by the 3rd Generation Partnership Project (3GPP) standardization organization in Release 8 (a technical specification version officially released by the 3GPP standardization organization in March 2009) and has been continuously optimized in subsequent versions. LTE Cat.1 is an important terminal category in LTE networks defining user equipment access capabilities and data transmission performance. Its technical specifications clearly define the basic communication capabilities of devices in 4G LTE networks. As a key component of cellular IoT, LTE Cat.1 supports uplink peak rates of 5 Mbit / s and downlink peak rates of 10 Mbit / s, providing cost-effective wireless connectivity solutions for IoT devices.
[0003] Currently, LTE Cat.1 is widely used in smart meters, asset tracking, wearable devices, smart parking spaces, and smart homes due to its low data rate, low cost, and low power consumption characteristics. With the rapid development of the Internet of Things (IoT), more and more device manufacturers are choosing LTE Cat.1 as the communication module for their products. Furthermore, with the widespread adoption of 5G networks, LTE Cat.1 may integrate with 5G technology to provide faster, lower-latency communication services. In addition, with the increasing number of IoT devices, LTE Cat.1 may be applied in more areas such as smart transportation and smart cities.
[0004] In existing LTE Cat.1 terminals, Flash memory, as a non-volatile storage medium, is used to store critical information such as network configuration parameters, location information, and status data. In an LTE network environment, LTE Cat.1 terminals frequently perform operations such as registration, cell camping, cell reselection, and Tracking Area Update (TAU), all of which involve real-time writing to the Flash memory. For example, LTE Cat.1 terminals update their identity and access parameters during power-on registration and network handover, periodically monitor signals and update cell camping information in idle mode, and perform TAUs to maintain connectivity when crossing tracking areas. Since Flash memory has a limited write / erase cycle life, typically 100,000 to 1 million cycles, frequent writing accelerates Flash wear, leading to an increase in bad blocks and potentially causing storage medium failure, resulting in data corruption or device malfunction. Therefore, there is an urgent need for a technical solution to effectively reduce the number of Flash writes to improve device lifespan. Summary of the Invention
[0005] In view of this, embodiments of this application provide a data read / write method for a terminal, a readable storage medium, a program product, and a terminal. The technical solution of this application can reduce unnecessary write operations to Flash memory without affecting the terminal's business operations, extend the lifespan of Flash memory, prevent premature terminal failure due to storage failure, and reduce device power consumption.
[0006] In a first aspect, this application provides a data read / write method for a terminal, the terminal including Flash memory, the Flash memory including multiple NV storage areas, each of the NV storage areas being used to store corresponding NV data, the method including: The startup state of the terminal is determined, and a reading strategy for reading NV data from at least a portion of the NV storage area of the Flash is determined based on the startup state of the terminal, wherein the NV storage area is divided according to the frequency of change of the NV data corresponding to the NV storage area during the operation of the terminal; The movement state of the terminal is determined, and a write strategy is determined based on the movement state of the terminal to write at least a portion of the parameters in the NV data into at least a portion of the NV storage area of the Flash, wherein the write operation when writing the at least a portion of the parameters into the at least a portion of the NV storage area of the Flash is at least partially triggered by a set trigger event.
[0007] In one possible implementation of the first aspect above, the plurality of NV storage regions include a first NV storage region, a second NV storage region, a third NV storage region, and a fourth NV storage region, wherein the first NV storage region is used to store first NV data, the second NV storage region is used to store second NV data, the third NV storage region is used to store third NV data, and the fourth NV storage region is used to store fourth NV data.
[0008] In one possible implementation of the first aspect above, the startup state of the terminal includes power-on, deep sleep wake-up, and soft boot, and the step of determining a read strategy for reading NV data from at least a portion of the NV storage area of Flash based on the startup state of the terminal includes: When the terminal is powered on, it is determined that first NV data is read from the first NV storage area of the Flash and third NV data is read from the third NV storage area of the Flash into the memory of the terminal; In the case of the terminal waking from deep sleep, it is determined that first NV data is read from the first NV storage area of the Flash, third NV data is read from the third NV storage area of the Flash, and fourth NV data is read from the fourth NV storage area of the Flash into the memory of the terminal; In the case of soft power-on of the terminal, the first NV data and the third NV data read into the memory when the terminal is powered on remain unchanged.
[0009] In one possible implementation of the first aspect above, the first NV data includes: radio frequency calibration parameters, network access parameters, device identification and authentication information, and configuration information; The second NV data includes: the terminal's dynamic context information; The third NV data includes: the terminal's dynamically configurable network management information; The fourth NV data includes: data that needs to be saved when the terminal is in deep sleep.
[0010] In one possible implementation of the first aspect described above, the method further includes: Determine the extent to which at least some parameters in the NV data affect the recovery of the terminal services; Based on the degree of influence of at least some parameters in the NV data on the recovery of terminal services, at least some parameters in the NV data are classified to obtain core parameters, auxiliary parameters, and non-critical parameters.
[0011] In one possible implementation of the first aspect above, the movement state of the terminal includes: a stationary state, a low-speed movement state, a medium-speed movement state, and a high-speed movement state.
[0012] In one possible implementation of the first aspect described above, the core parameters include AT command operation fields, candidate frequency point information, RPLMN information, and security context information, and the set triggering event includes a first triggering event. The step of determining a write strategy for writing at least a portion of the parameters in the NV data to at least a portion of the NV storage area of the Flash based on the movement state of the terminal includes: When the terminal is stationary or moving at low speed For the AT command operation field, a blocking operation is used to write the AT command operation field into the first NV storage area of the Flash in real time; If a first triggering event is detected, the candidate frequency information is written to the third NV storage area of the Flash using a non-blocking operation. When the terminal is in a soft shutdown or deep sleep state, the RPLMN information and security context information are written into the third NV storage area of the Flash memory.
[0013] In one possible implementation of the first aspect described above, the method further includes: Monitor power supply voltage; If the power supply voltage is detected to be lower than the set voltage threshold, and it is determined that the terminal is in the process of power failure, then the candidate frequency point information and RPLMN information are preferentially written into the third NV storage area of the Flash.
[0014] In one possible implementation of the first aspect described above, the auxiliary parameters include cell frequency information, CellId, SIB2 code stream, historical frequency information, and measured values, and the set trigger event includes a second trigger event. The step of determining a write strategy for writing at least a portion of the parameters in the NV data to at least a portion of the NV storage area of the Flash based on the movement state of the terminal includes: If a second triggering event is detected when the terminal is stationary or moving at low speed, the cell frequency information, Cell Id, SIB2 code stream, historical frequency information, and measurement values are written into the third NV storage area of the Flash.
[0015] In one possible implementation of the first aspect above, the non-critical parameters include timer information, temporary measurement reports, and intermediate states. The step of determining a write strategy for writing at least a portion of the parameters in the NV data into at least a portion of the NV storage area of the Flash based on the terminal's movement state includes: When the terminal is stationary or moving at low speed, if it is determined that the logical storage unit corresponding to the second NV storage area in the terminal needs to be powered down, the timer information, temporary measurement report and intermediate state are written into the second NV storage area of the Flash before the logical storage unit is powered down.
[0016] In one possible implementation of the first aspect above, determining the write strategy for writing at least a portion of the parameters in the NV data to at least a portion of the NV storage area of the Flash based on the mobile state of the terminal further includes: When the terminal is in a medium-speed or high-speed moving state For the case of cell reselection within the same frequency band of the terminal, if the terminal's TAU process is triggered, then when the TAU process ends and a second triggering event occurs, at least some of the core parameters and auxiliary parameters are written into the corresponding NV storage area in the Flash. For the case of cell reselection within the same frequency band of the terminal, if the terminal's TAU process is not triggered, then before the terminal is powered off or when the second triggering event occurs, at least some of the core parameters and auxiliary parameters are written into the corresponding NV storage area in the Flash. For inter-frequency cell reselection of the terminal, if the terminal's TAU procedure is triggered, then when the TAU procedure ends and a second triggering event occurs, at least some of the core parameters and auxiliary parameters are written into the corresponding NV storage area in the Flash. For inter-frequency cell reselection of the terminal, if the terminal's TAU procedure is not triggered, the candidate frequency information in the core parameters is updated, and before the terminal is powered off or when the second triggering event occurs, at least some of the updated core parameters and at least some of the auxiliary parameters are written into the corresponding NV storage area in the Flash. In the event of a connection state switch of the terminal, at least some of the core parameters and auxiliary parameters are written into the corresponding NV storage area in the Flash.
[0017] In one possible implementation of the first aspect above, the movement state of the terminal is determined in the following manner: The mobility status of the terminal is determined based on the number of times the terminal performs cell reselection or cell handover within a set time range.
[0018] Secondly, this application provides a computer-readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the terminal data read / write method described in the first aspect and any possible implementation thereof.
[0019] Thirdly, this application provides a computer program product including instructions that, when executed by one or more processors, implement the terminal data read / write method as described in the first aspect and any possible implementation thereof.
[0020] Fourthly, this application provides a terminal, including: Memory, used to store instructions, and One or more processors, when the instructions are executed by the one or more processors, perform the terminal data read / write method as described in the first aspect above and any possible implementation of the first aspect.
[0021] Compared with the prior art, the beneficial effects of this application are as follows: This application determines the mobile state of the terminal and determines the write strategy for writing at least some parameters in the NV data to at least some NV storage areas of the Flash based on the mobile state of the terminal. This allows the terminal to have a corresponding write strategy in different mobile states. Furthermore, since the write operation when writing at least some parameters to at least some NV storage areas of the Flash is at least partially triggered by a set trigger event, unnecessary write operations to the Flash can be reduced without affecting the terminal's business. This not only extends the lifespan of the Flash and prevents the terminal from prematurely failing due to storage failure, but also reduces device power consumption. Attached Figure Description
[0022] Figure 1 According to some embodiments of this application, an application scenario of a terminal is shown; Figure 2 According to some embodiments of this application, a flowchart of a data reading and writing method for a terminal is shown; Figure 3 According to some embodiments of this application, a simplified schematic diagram of a terminal reading and writing NV at different stages is shown; Figure 4 According to some embodiments of this application, a structural block diagram of a terminal is shown. Detailed Implementation
[0023] The illustrative embodiments of this application include, but are not limited to, a data reading and writing method based on a terminal, a readable storage medium, a program product, and a terminal.
[0024] To facilitate understanding of the technical solution of this application, some technical terms that may be involved in this application will be explained below.
[0025] 1) Non-volatile storage (NV storage), hereinafter referred to as NV, refers to storage media that can retain data after power failure. Its core characteristic is data persistence, and it is widely used in electronic devices that need to store data for a long time.
[0026] 2) Flash memory is one of the mainstream non-volatile memory technologies, characterized by high density, low power consumption, and fast read / write speeds. When an NV (Virtual Machine) needs to store data, it maps logical addresses to physical sectors of the Flash memory and writes the data to the Flash memory via a driver. In other words, Flash memory is the hardware carrier of the NV. The software layer accesses data through the NV interface, but the underlying layer relies on hardware entities such as Flash memory; the two have a "logical-physical" mapping relationship.
[0027] 3) Power On Boot of the terminal Terminal power-on refers to the process by which a terminal starts from a completely powered-off state and establishes communication services through a complete system initialization and network access procedure. Key processes include: hardware power-on and self-test, frequency band scanning and PLMN selection, cell search and synchronization, system information reading, security authentication, and registration / attachment. Its characteristics include a complete startup process involving full-link initialization, such as radio frequency and protocol stack loading, which is time-consuming and consumes more power, but ensures that the terminal accesses the network from a zero state and obtains all service capabilities. Application scenarios are mainly applicable to user manual power-on, restarting of devices after long periods of inactivity, or initial configuration during first network access, providing basic communication connections and identity authentication for the terminal.
[0028] 4) Terminal Soft Boot Terminal soft boot refers to the process by which a terminal, while retaining some power and context information, quickly restores itself to a communicable state through a rapid initialization process. Key processes include: waking up retained hardware modules, reusing existing network configurations, simplified random access and RRC connection reconstruction, and rapid NAS layer registration and updates. Its characteristics include skipping hardware cold boot and full network search, relying on historical context for rapid access, and reducing boot latency and power consumption. Application scenarios include: waking devices from sleep / low-power mode, restarting after a temporary interruption, or rapid reconnection after a network switch. It is suitable for scenarios sensitive to boot speed and with a stable network environment, such as daily wake-up of smart wearable devices.
[0029] 5) Terminal Deep Sleep Wakeup Terminal deep sleep wake-up refers to the process by which a terminal recovers from an extremely low-power deep sleep state to an active communication state through a specific triggering mechanism. Key processes include: extremely low-power hibernation of hardware modules (e.g., shutting down radio frequency and most baseband), periodic listening for wake-up signals / timer triggers, rapid frame synchronization and system information acquisition, and rebuilding the RRC (Radio Resource Control) connection as needed or directly entering data transmission. Its characteristics are: only necessary timing and storage modules are maintained during hibernation, wake-up latency is controllable, and device battery life can be extended. Application scenarios include periodic data acquisition, low-frequency communication terminals, and mobile devices requiring long standby times and fast responses, sacrificing some real-time performance for extreme power optimization.
[0030] 6) Cell reselection on the same frequency In-frequency cell reselection refers to the process by which a terminal, in an idle state, autonomously selects and switches to a cell with better signal quality within the same frequency band, based on the network-configured list of neighboring cells and measurement rules. This process is based on the terminal's continuous monitoring of the signal strength of the current serving cell and neighboring cells. It is triggered when a neighboring cell meets preset reselection criteria, such as the R criterion (a cell reselection criterion), where the target cell's ranking value Rn is consistently better than the serving cell's Rs for a certain time threshold, and the terminal remains camped on the current cell for more than one second. Its core objective is to ensure that the terminal always accesses the cell with the best signal quality within the same frequency band by autonomously optimizing its camping location, thereby improving communication stability and resource utilization. This mechanism is particularly crucial when intra-frequency priority is higher than inter-frequency priority, avoiding unnecessary inter-frequency handovers.
[0031] 7) Inter-frequency cell reselection Inter-frequency cell reselection refers to the behavior of a terminal switching from its current serving frequency band to a cell in another frequency band that meets signal quality requirements, based on the frequency priority and measurement parameters broadcast by the system, when the terminal is idle. Inter-frequency cell reselection, by introducing a frequency priority strategy, supports network load balancing and differentiated quality of service assurance, and is a key technology for cross-frequency band mobility management.
[0032] 8) Connected state The connected state, or RRC_CONNECTED state, is an active state in which the terminal has established a complete signaling connection and data transmission channel with the radio access network and core network. In this state, the terminal maintains uplink and downlink resource allocation with the base station, supports real-time data transmission and dynamic resource scheduling, and ensures service continuity during mobility through technologies such as handover and link adaptation. In the connected state, the terminal is controlled by the network and can execute handover procedures based on coverage, load, or service, and supports various radio bearer configurations to meet different service requirements.
[0033] 9) Idle state The idle state, or RRC_IDLE state, is a low-power camping state in which the terminal has no signaling connection with the network and is not transmitting data. In this state, the terminal maintains network configuration synchronization by periodically listening to system messages, such as SIB1 / SIB3, autonomously performing cell selection and reselection to optimize its camping location, and maintaining reachability through the tracking area registration update mechanism. In the idle state, the terminal only saves necessary context, such as the PLMN (Public Land Mobile Network) identifier and TA (Tracking Area) list, significantly reducing power consumption and signaling overhead. However, it can quickly recover to the connected state through paging or random access to respond to service requests initiated by the network or users. Its core functions include location management, mobility optimization, and resource saving, and it is the basic operating mode for the terminal when stationary or under low service demand.
[0034] 10) Attach procedure The attach procedure is the core process for a terminal to re-register with the LTE network upon its first network access or after a long period of disconnection. It establishes a connection between the terminal and the core network, allocates necessary resources, and ensures the terminal acquires basic communication capabilities and enters a serviceable state. The attach procedure includes the following steps: 1. When a user equipment (UE) in the RRC_IDLE state initiates the Attach procedure, it first sends a random access procedure, i.e., the MSG1 message. 2. After detecting the MSG1 message, the eNB (evolved NodeB) sends a random access response message, i.e., the MSG2 message, to the UE; 3. After receiving the random access response, the UE adjusts the uplink transmission timing according to the TA of MSG2 and sends an RRCConnectionRequest message to the eNB; 4. The eNB sends an RRCConnectionSetup message to the UE, which includes information on establishing the SRB1 bearer and radio resource configuration information; 5. The UE completes the SRB1 bearer and radio resource configuration and sends an RRCConnectionSetupComplete message to the eNB, which includes NAS layer Attach request information; 6. The eNB selects the MME and sends an INITIAL UE MESSAGE message to the MME, which includes a NAS (Non-Access Stratum) Attach request message; 7. The MME (Mobility Management Entity) sends an INITIALCONTEXT SETUP REQUEST message to the eNB to request the establishment of a default bearer, which includes NAS layer Attach Accept and Activatedefault EPS bearer context request messages; 8. When the eNB receives the INITIAL CONTEXT SETUP REQUEST message, if it does not contain UE capability information, the eNB sends a UECapabilityEnquiry message to the UE to query the UE's capabilities; 9. The UE sends a UECapabilityInformation message to the eNB to report the UE's capability information; 10. The eNB sends a UE CAPABILITY INFO INDICATION message to the MME to update the MME's UE capability information; 11. The eNB sends a SecurityModeCommand message to the UE to activate security based on the security information supported by the UE in the INITIAL CONTEXT SETUP REQUEST message; 12. The UE sends a SecurityModeComplete message to the eNB, indicating that security activation is complete; 13. Based on the ERAB establishment information in the INITIAL CONTEXT SETUP REQUEST message, the eNB sends an RRCConnectionReconfiguration message to the UE to perform UE resource reconfiguration, including reconfiguring SRB1 and radio resource configuration, and establishing SRB2 and DRB (including the default bearer). 14. The UE sends an RRCConnectionReconfigurationComplete message to the eNB to indicate that the resource configuration is complete; 15. The eNB sends an INITIAL CONTEXT SETUP RESPONSE response message to the MME, indicating that the UE context establishment is complete; 16. The UE sends a UL direct transfer message to the eNB, which includes the NAS layer Attach Accept and Activatedefault EPS bearer context accept messages; 17. The eNB sends an uplink direct transmission ULNAS (UPLINK NAS) transport message to the MME, which includes the NAS layer AttachAccept and Activate default EPS bearer context accept messages.
[0035] 11) LTE TAU process The LTE TAU (Tracking Area Update) procedure is a crucial process for terminals to update their location information to the core network in either idle or connected states. It ensures the network can accurately track the terminal's Tracking Area (TA) and maintain its reachability. This procedure is divided into Idle TAU and Connected TAU. The Idle TAU procedure includes the following steps: 1. The UE sends a RA Preamble message to the eNB; 2. The eNB returns a RA Response message to the UE; 3. The UE sends an RRC Connection Request message to the eNB; 4. The eNB returns an RRC Connection Setup message to the UE; 5. The UE sends an RRC Connection Complete message to the eNB, which includes a TAU request message; 6. The eNB sends an Initial UE Message to the EPC, which includes a TAU request message; 7. Two-way authentication (Authentication / Security) between EPC and UE ensures the legitimacy of the UE; 8. EPC updates UE context and other information between MMEs; 9. The EPC sends a DOWNLINK NAS TRANSPOR message to the eNB, which includes a TAU Accept message; 10. The eNB sends a DL Information Transfer message to the UE, which includes a TAU Complete message; 11. The UE sends a UL Information Transfer message to the eNB, which includes a TAU Complete message; 12. The eNB sends an UPLINK NAS TRANSPORT message to the EPC, which includes a TAU Accept message; 13. The EPC sends a UE CONTEXT RELEASE COMMANDA message to the eNB; 14. The eNB sends an RRC Connection Relase message to the UE, and the UE enters IDLE mode again; 15. The eNB sends a UE CONTEXT RELEASE COMPLETE message to the EPC.
[0036] The process of a connected TAU includes the following steps: 1. The UE sends a ULInformation Transfer message to the eNB, which includes a TAU request message; 2. The eNB sends an UPLINK NAS TRANSPORT message to the EPC, which includes a TAU request message; 3. The EPC updates UE context and other information at MME intervals; 4. The EPC sends a DOWNLINK NAS TRANSPORT message to the eNB, which includes a TAU Accept message; 5. The eNB sends a DLInformation Transfer message to the UE, which includes a TAU Accept message; 6. The UE sends a ULInformation Transfer message to the eNB, which includes a TAU Complete message; 7. The eNB sends an UPLINK NAS TRANSPORT message to the EPC, which includes a TAU Complete message.
[0037] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0038] To facilitate understanding of the technical solution of this application, the following will first combine... Figure 1 This paper provides a detailed description of one application scenario of the technical solution presented in this application. (Reference) Figure 1This includes terminal 100, base station 200, and core network 300. After terminal 100 is powered on, it first searches for and selects the cell with the best signal to complete camping and establishes an initial connection with base station 200. Then, it initiates a registration request to core network 300 through base station 200. Core network 300 authenticates the identity of terminal 100 and allocates communication resources to establish a data transmission channel for terminal 100. Finally, under the wireless signal coverage of base station 200, terminal 100 uses the connection management and routing functions of core network 300 to achieve real-time communication with the Internet or other terminals 100, and complete data transmission and interactive services.
[0039] The terminal 100 adopts the data read / write method provided in this application. By determining the movement state of the terminal 100, a write strategy is determined based on the movement state of the terminal 100 to write at least some parameters in the NV data to at least a portion of the NV storage area of the Flash. This ensures that the terminal 100 has a corresponding write strategy in different movement states. Furthermore, since the write operation when writing at least some parameters to at least a portion of the NV storage area of the Flash is at least partially triggered by a set trigger event, unnecessary write operations to the Flash can be reduced without affecting the services of the terminal 100. This can extend the lifespan of the Flash in the terminal 100, prevent the terminal 100 from being prematurely scrapped due to storage failure, and also reduce the power consumption of the terminal 100.
[0040] The following will combine Figure 2 and Figure 3 This application provides a detailed description of a data read / write method for a terminal 100. The terminal 100 includes Flash memory, which comprises multiple NV storage areas, each used to store corresponding NV data. It should be understood that each NV storage area is the physical storage space corresponding to each NV of the terminal 100; that is, when an NV needs to store data, its logical address is mapped to each NV storage area of the Flash memory.
[0041] In some embodiments, NVs can be divided into four categories based on the frequency of data changes stored in the NVs of the terminal 100, thereby achieving classified data storage. For example, the NVs in the terminal 100 can be divided into Factory NVs, Retention NVs, History NVs, and DeepSleep NVs. The Factory NV stores factory-related information, including RF calibration parameters, network access parameters, device identification and authentication information, and configuration information. The Retention NV stores dynamic context information of the terminal 100 that is prone to change, including the remaining duration of various UE timers, serving cell information, forbidden Plmn, security key, and count value. The History NV stores dynamically modifiable information, which changes less frequently than the data stored in the Retention NV. This includes storage frequency points, serving cell ID and key SIB, registration information and security context information, EPLMN list information, TAI list information, IMSI information, and preset frequency points and preset frequency band information. The DeepSleep NV stores information that needs to be saved when the terminal 100 is in deep sleep. This type of information is generally not easy to change and is relatively stable. It is only stored in the DeepSleep NV before the terminal 100 goes into deep sleep.
[0042] In some embodiments, to balance the wear risk of the NV in the terminal 100, extend the lifespan of the NV, and ensure the reliability and performance of the NV, this application adopts the following wear leveling methods for the four types of NVs classified above: For Factory NVs, which are 4KB in size, a 2x wear leveling method is used, requiring 8KB of Flash space, for example... Figure 3 The NV1-factory size is 4KB. It should be understood that, corresponding to Factory Nv, and since it uses 2x wear leveling, there should also be a corresponding NV2-factory in the flash memory. Figure 3 (Not shown in the image).
[0043] For Retention NV, its size is 4KB, for example Figure 3 The Retention Memory in the memory requires 4KB of Flash space for storage and recovery if the Retention NV needs to be powered off, and wear leveling is not required.
[0044] For History Nv, its size is 4KB, it uses 3x wear leveling, and requires 12KB of Flash space, for example. Figure 3NV2-historyNv-1, NV2-historyNv-2, and NV2-historyNv-3; For DeepSleep Nv, its size is 8KB, it uses 2x wear leveling, and requires 16KB of Flash space, for example. Figure 3 NV3-deepsleepNv-1 and NV3-deepsleepNv-2.
[0045] It should be noted that the NV values mentioned in the above four figures are merely illustrative examples to illustrate the technical solution of this application. In practical applications, the NV values and corresponding wear leveling methods can be adjusted according to actual conditions, and this application does not impose any limitations on them.
[0046] refer to Figure 2 The data read / write method for a terminal 100 provided in this application includes the following steps: S11: Determine the startup state of terminal 100, and determine a read strategy for reading NV data from at least a portion of the NV storage area of Flash based on the startup state of terminal 100. NV data refers to the data stored in the NV storage area of Flash.
[0047] The NV storage area is divided according to the frequency of change of the NV data corresponding to that area during the operation of the terminal 100. In other words, the NV data stored in different NV storage areas changes at different frequencies during the operation of the terminal 100. By storing data with different change frequencies in different NV storage areas, it is beneficial to perform area-based read and write operations on the Flash memory. This allows for flexible configuration of read strategies for different NV storage areas, reduces unnecessary read and write operations, avoids excessive wear and tear on some storage areas of the Flash memory, and extends the lifespan of the Flash memory.
[0048] In some embodiments, the plurality of NV storage regions include a first NV storage region, a second NV storage region, a third NV storage region, and a fourth NV storage region, wherein the first NV storage region is used to store first NV data, the second NV storage region is used to store second NV data, the third NV storage region is used to store third NV data, and the fourth NV storage region is used to store fourth NV data.
[0049] In some embodiments, the first NV storage area is the storage area in the Flash of the terminal 100 that corresponds to the Factory Nv mentioned above, and the logical address of the Factory Nv corresponds to the physical address of the first NV storage area.
[0050] In some embodiments, the second NV storage area is the storage area in the Flash of the terminal 100 that corresponds to the aforementioned RetentionNV, and the logical address of the Retention NV corresponds to the physical address of the second NV storage area.
[0051] In some embodiments, the third NV storage area is the storage area in the Flash of the terminal 100 that corresponds to the aforementioned History Nv, and the logical address of the History Nv corresponds to the physical address of the third NV storage area.
[0052] In some embodiments, the fourth NV storage area is the storage area in the Flash of the terminal 100 that corresponds to the aforementioned DeepSleepNv, and the logical address of DeepSleep Nv corresponds to the physical address of the fourth NV storage area.
[0053] In some embodiments, the first NV data is the factory-related information stored in the aforementioned Factory NV, and the first NV data includes: radio frequency calibration parameters, network access parameters, device identification and authentication information, and configuration information.
[0054] In some embodiments, the second NV data is the dynamic context information of the terminal 100 that is easily changed and stored in the aforementioned Retention NV. In other words, the second NV data includes: the dynamic context information of the terminal 100, which includes: the remaining duration of various UE timers, serving cell related information, forbidden Plmn, security key, and count value, etc.
[0055] In some embodiments, the third NV data refers to the dynamically modifiable information stored in the aforementioned History NV. This information is called the dynamically configurable network management information of terminal 100. In other words, the third NV data includes the dynamically configurable network management information of terminal 100. In some embodiments, the dynamically configurable network management information of terminal 100 includes candidate frequency points, serving cell ID and key SIB, registration information and security context information, EPLMN list information, TAIlist information, IMSI information, and preset frequency points and preset frequency band information, etc.
[0056] In some embodiments, the fourth NV data is the information that the terminal 100 needs to save when it is in deep sleep, which is stored in the aforementioned DeepSleep NV. In other words, the fourth NV data includes the data that the terminal 100 needs to save when it is in deep sleep.
[0057] In some embodiments, the startup states of the terminal 100 include power-on, deep sleep wake-up, and soft boot. Based on the startup state of the terminal 100, a read strategy for reading NV data from at least a portion of the NV storage area of the Flash memory is determined, including: When the terminal 100 is powered on, it is determined that the first NV data is read from the first NV storage area of the Flash and the third NV data is read from the third NV storage area of the Flash into the memory of the terminal 100.
[0058] In other words, since the data in Flash needs to be read into memory when the terminal 100 is powered on to ensure the initialization of the terminal 100's functions, quickly start the software system and access the network to realize communication services, it is determined that the first NV data stored in the first NV storage area corresponding to Factory Nv in Flash and the third NV data stored in the third NV storage area corresponding to History Nv in Flash will be read into the memory of the terminal 100 when the terminal 100 is powered on.
[0059] When the terminal 100 wakes up from deep sleep, it is determined to read the first NV data from the first NV storage area of the Flash, the third NV data from the third NV storage area of the Flash, and the fourth NV data from the fourth NV storage area of the Flash into the memory of the terminal 100.
[0060] In other words, in the case of waking up from deep sleep, in order to quickly restore the terminal 100 to its state before sleep, it is necessary to read the first NV data stored in the first NV storage area corresponding to Factory Nv in Flash, the third NV data stored in the third NV storage area corresponding to History Nv in Flash, and the fourth NV data stored in the fourth NV storage area corresponding to DeepSleep Nv in Flash into memory.
[0061] It should be noted that since the Retention NV is essentially powered continuously, it is never powered down during the sleep mode of terminal 100. In other words, the Retention NV always exists and its content remains valid. In some embodiments, even if the Retention NV needs to be powered down during the deep sleep state of terminal 100, the data stored in the Retention NV will be written to the corresponding storage area in Flash before power-down, such as the aforementioned second NV storage area. Thus, when terminal 100 wakes up from deep sleep, the second NV data can be read from the second NV storage area in Flash and restored to the memory of terminal 100.
[0062] In the case of soft power-on of terminal 100, the first NV data and the third NV data read into memory by terminal 100 during power-on remain unchanged. In some embodiments, in the case of soft power-on of terminal 100, the second and fourth storage areas in Flash are also cleared, or only a small amount of information is retained in the second storage area, because this information is no longer valid in the process of restarting terminal 100 and may be overwritten by new data.
[0063] In some embodiments, the data read / write method for a terminal 100 provided in this application further includes: The impact of at least some parameters in the NV data on the recovery of terminal 100 services is determined. Based on the impact of at least some parameters in the NV data on the recovery of terminal 100 services, the parameters in the NV data are classified into core parameters, auxiliary parameters, and non-critical parameters. It should be understood that the NV data here includes the first NV data, second NV data, third NV data, and fourth NV data mentioned above.
[0064] For example, in some embodiments, NV data includes AT command operation fields, candidate frequency point information, RPLMN information, security context information, cell frequency point information, Cell ID, SIB2 code stream, historical frequency point information, measurement values, timer information, temporary measurement reports, and intermediate states. Based on the degree of impact of this data on the recovery of terminal 100 services, this NV data is categorized into core parameters, auxiliary parameters, and non-critical parameters.
[0065] At least some parameters in the aforementioned NV data are classified according to their impact on the recovery of terminal 100 services. This allows for differentiated storage of the classified data, which not only ensures the normal operation of terminal 100 services but also reduces write operations to the terminal 100's Flash memory, thus helping to extend the Flash memory's lifespan.
[0066] S12: Determine the movement state of terminal 100, and determine a write strategy for writing at least some parameters in NV data to at least a portion of the NV storage area of Flash based on the movement state of terminal 100, wherein the write operation when writing at least some parameters to at least a portion of the NV storage area of Flash is at least partially triggered by a set trigger event.
[0067] In some embodiments, the movement state of terminal 100 includes: stationary state, low-speed movement state, medium-speed movement state, and high-speed movement state. In some embodiments, the movement state of terminal 100 is determined by: determining the movement state of terminal 100 based on the number of times terminal 100 performs cell reselection or cell handover within a set time range.
[0068] For example, if the time range is set to 1 minute, and the number of times terminal 100 performs cell reselection is less than or equal to 1 within 1 minute, then terminal 100 is determined to be stationary or moving at low speed.
[0069] For example, if the time range is set to 1 second, and the number of times terminal 100 performs cell reselection exceeds 1 within 1 second, then terminal 100 is determined to be in a high-speed moving state.
[0070] It should be noted that the specific values of the time range and the number of cell reselections mentioned above can be determined according to the actual situation. The specific values of the time range and the number of cell reselections in the above embodiments do not constitute a limitation on the technical solution of this application.
[0071] In some embodiments, the core parameters mentioned above include AT command operation fields, candidate frequency point information, RPLMN information, and security context information. The set trigger event includes a first trigger event. Then, based on the movement state of the terminal 100, a write strategy is determined to write at least some parameters from the NV data to at least a portion of the NV storage area of the Flash memory, including: When terminal 100 is stationary or moving at low speed For the AT command operation field, a blocking operation is used to write the AT command operation field to the first NV storage area of Flash in real time; For candidate frequency information, if the first trigger event is detected, the candidate frequency information is written to the third NV storage area of Flash using a non-blocking operation. For RPLMN information and security context information, when the terminal 100 is in soft shutdown or deep sleep, the RPLMN information and security context information are written to the third NV storage area of Flash.
[0072] Specifically, for the AT command operation field, the blocking operation method for writing the AT command operation field to the first NV storage area of Flash in real time means that when writing the AT command operation field to the first NV storage area of Flash, the terminal 100 will pause other operations until the AT command operation field is successfully written to the first NV storage area of Flash before notifying the upper layer that the write has been successful. This ensures that even if the terminal 100 immediately loses power after receiving the successful write notification, the AT command operation field is safely saved, preventing loss due to incomplete writing. It should be understood that the AT command operation field is a core configuration parameter of the terminal 100, directly affecting its functionality and state. Using a blocking operation to write the AT command operation field to Flash can prevent configuration loss due to upper-layer misoperation or power failure, thereby ensuring the deterministic execution of the terminal 100's functions and system stability.
[0073] In some embodiments, the first triggering event mentioned above is: when the connection state of terminal 100 is completed, the NAS layer notifies the RRC layer to trigger a write operation to Flash for candidate frequency point information. Specifically, for candidate frequency point information, if the first triggering event is detected, writing the candidate frequency point information to the third NV storage area of Flash using a non-blocking operation means: when the connection state is completed, the NAS layer notifies the RRC layer to trigger a write operation to Flash for candidate frequency point information, writing the candidate frequency point information to Flash. Simultaneously, the key SIB code stream, such as SIB2, is also written to the third NV storage area of Flash along with the candidate frequency point information. In some embodiments, the writing of candidate frequency points uses a non-blocking operation, that is, starting a separate thread. This thread has a lower priority, generally lower than the business thread. This separate thread acts as a background thread to asynchronously write to Flash, thus avoiding blocking the main thread and not affecting the continuity of business operations.
[0074] Regarding RPLMN and security context information, when the terminal 100 is in a soft shutdown or deep sleep state, writing the RPLMN and security context information to the third NV storage area of the Flash memory specifically means: writing them to the USIM card of the terminal 100 in real time after the connection state of the terminal 100 is completed; only when the terminal 100 is in a soft shutdown or deep sleep state is the RPLMN and security context information written to the third NV storage area of the Flash memory written. In this way, when the terminal 100 performs a deep sleep wake-up process, it is not necessary to initialize the USIM card; the RPLMN and security context information can be directly restored from the third NV storage area of the Flash memory for continued use, which can shorten the service recovery time and reduce power consumption.
[0075] In some embodiments, the data read / write method for the terminal 100 provided in this application further includes: The system monitors the power supply voltage. If the power supply voltage is detected to be lower than a set voltage threshold, it determines that the terminal 100 is in a power-down process. In this case, it prioritizes writing candidate frequency point information and RPLMN information to the third NV storage area of the Flash memory in real time. By prioritizing the saving of RPLMN information and candidate frequency point information during a power-down process, this application ensures that the terminal 100 quickly restores network connectivity after restarting, reduces latency and power consumption during network-wide searches, improves user experience, and ensures that critical communication parameters are not lost, thus enhancing system robustness.
[0076] In some embodiments, the auxiliary parameters include cell frequency information, Cell ID, SIB2 code stream, historical frequency information, and measured values. The set trigger event includes a second trigger event. Then, based on the mobility state of the terminal 100, a write strategy is determined to write at least a portion of the parameters in the NV data to at least a portion of the NV storage area of the Flash memory, including: When terminal 100 is stationary or moving at low speed, if a second trigger event is detected, the cell frequency information, Cell ID, SIB2 code stream, historical frequency information, and measurement values are written to the third NV storage area of Flash. The cell frequency information refers to the service frequency information of the cell where terminal 100 is currently camped, and the historical frequency information refers to the service frequency information of the cells where terminal 100 has previously camped. In the network search logic of the terminal 100 power-on process, cell frequency information, Cell ID, and measurement values are used to determine whether the terminal 100 needs to perform discrete frequency search or only perform cell search of the original cell. The SIB2 code stream is a specific data stream sent by the base station 200 to the terminal 100 to configure the common parameters of the physical layer of the terminal 100. At the same time, the terminal 100 uses this information to measure the wireless environment and receive paging messages from the base station 200 to ensure that the terminal 100 can correctly decode network signals and respond to network requests in a timely manner. The historical frequency information consists of candidate frequency points, different frequency points in Sib5, and frequency points collected in the movement trajectory of the terminal 100. During discrete frequency search, these frequency points are used for discrete frequency scanning, which can shorten the cell dwell time.
[0077] In some embodiments, the second triggering event mentioned above refers to the terminal 100 leaving the RRC connected state and returning to the idle state. Therefore, the above-mentioned action of writing cell frequency information, Cell Id, SIB2 code stream, historical frequency information, and measurement values into the third NV storage area of Flash if the second triggering event is detected specifically means that: for cell frequency information, Cell Id, SIB2 code stream, historical frequency information, and measurement values, after the terminal 100 receives or updates this information, it does not write it into the corresponding storage area in Flash in real time, but only triggers a Flash write operation once during the subsequent process of leaving the RRC connected state and returning to the idle state. Furthermore, if other information needs to be written into the third NV storage area of Flash at the same time as this information is written, then the other information and the aforementioned information can be written into the third NV storage area of Flash simultaneously.
[0078] It should be understood that during the service initiation process of terminal 100, the connection state is maintained for a long time and the connection state may switch frequently. As a result, the corresponding serving cell is updated many times and the cell data is also updated many times. If the updated cell data is written to Flash every time the serving cell is updated, the frequent write operation will affect the lifespan of Flash. Therefore, with the above-mentioned technical solution of this application, the write operation to Flash is only triggered when the corresponding trigger time is detected, which neither affects the service nor reduces the number of writes to Flash.
[0079] As described above, in the technical solution of this application, if a second triggering event is detected, the SIB2 bitstream in the SIB bitstream will be written to the third NV storage area of the Flash memory. Other SIBs are not saved. For example, for Sib5, the different frequency points are dynamically obtained through neighbor cell measurement results. When the terminal 100 returns to the idle state, it uniformly writes SIB2 and its associated frequency point information to the third NV storage area of the Flash memory.
[0080] In some embodiments, after successfully camping on an idle cell, before writing to Flash, it is necessary to determine whether there is a cached connection establishment. If so, Flash is not written temporarily, and the connection establishment process is initiated. Flash is written when the new connection is released and the idle state is returned. The reason for doing this is to consider the concurrent reading of system information such as Sib5 and the business process. After all Sib5 intermediate frequency points are collected, they can be stored together when the terminal returns to the idle state.
[0081] For auxiliary parameters, besides writing them to Flash along with other processes and triggering a Flash write once when returning from connected state to idle state, other parameters are only written to Flash during soft shutdown or deep sleep. This reduces the number of Flash writes.
[0082] In some embodiments, before writing to the Flash, it is possible to first read whether the data in the Flash storage space to be written is the same as the data to be written. If they are the same, the Flash writing operation is not performed, which also helps to reduce the number of Flash writes.
[0083] In some embodiments, non-critical parameters include timer information, temporary measurement reports, and intermediate states. Based on the movement state of the terminal 100, a write strategy is determined to write at least a portion of the parameters in the NV data to at least a portion of the NV storage area of the Flash memory, including: When the terminal 100 is stationary or moving at low speed, if it is determined that the logical storage unit corresponding to the second NV storage area in the terminal 100 needs to be powered down, the timer information, temporary measurement report and intermediate state are written to the second NV storage area of Flash before the logical storage unit is powered down, so as to ensure data integrity in the event of sudden power failure or abnormal shutdown.
[0084] Among them, the temporary measurement report refers to the measurement results reported by the physical layer; the intermediate state refers to the process at the terminal that may be divided into multiple steps, and the state that has not yet reached completion is called the intermediate state.
[0085] In some embodiments, determining a write strategy for writing at least a portion of the parameters in the NV data to at least a portion of the NV storage area of the Flash based on the movement state of the terminal 100 further includes: When terminal 100 is in a medium-speed or high-speed moving state For the same-frequency cell reselection of terminal 100, if the TAU process of terminal 100 is triggered, then at least some of the core parameters and auxiliary parameters are written to the corresponding NV storage area in Flash after the TAU process ends and a second triggering event occurs; for the same-frequency cell reselection of terminal 100, if the TAU process of terminal 100 is not triggered, then at least some of the core parameters and auxiliary parameters are written to the corresponding NV storage area in Flash before terminal 100 is powered off or when a second triggering event occurs. For inter-frequency cell reselection of terminal 100, if the TAU process of terminal 100 is triggered, then when the TAU process ends and a second triggering event occurs, at least some of the core parameters and auxiliary parameters are written to the corresponding NV storage area in Flash. For inter-frequency cell reselection of terminal 100, if the TAU process of terminal 100 is not triggered, the candidate frequency information in the core parameters is updated, and before terminal 100 is powered off or when a second triggering event occurs, at least some of the updated core parameters and at least some of the auxiliary parameters are written to the corresponding NV storage area in Flash. In the case of connection state switching of terminal 100, when the second trigger event occurs, at least some of the core parameters and auxiliary parameters are written to the corresponding NV storage area in Flash.
[0086] In some embodiments, when the terminal 100 is in a medium-speed or high-speed moving state, for the same-frequency cell reselection of the terminal 100, if the TAU process of the terminal 100 is triggered, a write operation to Flash is triggered only when the terminal 100 returns from the connected state to the idle state. For example, the candidate frequency point information in the core parameters is written to the third NV storage area of Flash, and the SIB2 code stream, historical frequency points, and measurement values in the auxiliary parameters are also written to the third NV storage area of Flash. If the TAU process of the terminal 100 is not triggered, the write operation to Flash is not triggered. The Flash is written uniformly before the terminal 100 is powered off or when it returns from the connected state to the idle state. That is, the parameters are written to Flash in batches, reducing the number of Flash writes, which can extend the Flash life. By reducing the Flash write frequency, the peak power consumption of Flash can be reduced, the energy efficiency of the terminal can be optimized, and the terminal is more conducive to the application of the terminal in battery-sensitive application scenarios. These battery-sensitive scenarios include, but are not limited to, wearable devices and remote monitoring terminals.
[0087] In some embodiments, when the terminal 100 is in a medium-speed or high-speed moving state, for inter-frequency cell reselection of the terminal 100, if the TAU process of the terminal 100 is triggered, a write operation to Flash is triggered only when the terminal 100 returns from the connected state to the idle state. For example, the candidate frequency point information in the core parameters is written to the third NV storage area of Flash, and the SIB2 code stream, historical frequency points, and measurement values in the auxiliary parameters are also written to the third NV storage area of Flash. If the TAU process is not triggered, the candidate frequency point information in the core parameters is updated. For example, the service frequency point information of the current cell is added to the candidate frequency point list, and the order of the candidate frequency points is changed. The Flash is not written in real time. The updated candidate frequency point information in the core parameters and the SIB2 code stream information in the auxiliary parameters are written to the corresponding NV storage area of Flash only before the terminal 100 is powered off or when it returns from the connected state to the idle state.
[0088] In some embodiments, when the terminal 100 is in a medium-speed or high-speed moving state, for the connection state switching of the terminal 100, that is, when the connection state changes the serving cell and the service is maintained, then after the network is released and the terminal returns from the connection state to the idle state, a write-to-Flash operation of at least some of the core parameters and auxiliary parameters is triggered.
[0089] It is understood that the execution order of steps S11 to S12 above is only an illustration. In other embodiments, other execution orders may be used, and some steps may be split or combined. This is not limited here.
[0090] The technical solution of this application stipulates that the write operation when writing at least some parameters to at least a portion of the NV storage area of the Flash is at least partially triggered by a set trigger event. This reduces unnecessary write operations to the Flash without affecting the terminal's business, which can not only extend the life of the Flash and prevent the terminal from being scrapped prematurely due to storage failure, but also reduce the power consumption of the device.
[0091] Furthermore, in the prior art, if a power outage, system reset, or interference occurs during the Flash writing process, the data writing may be incomplete, resulting in a "partial writing" phenomenon, which may lead to data errors or metadata corruption. However, this application uses the aforementioned triggering event to trigger the Flash writing operation, which can reduce the risk of data loss due to a single write failure and improve reliability.
[0092] In existing technologies, Flash writes are typically synchronous operations. Frequent writes consume system resources such as CPU and bus, causing other terminal tasks, such as communication and sensor data acquisition, to be blocked, thus affecting real-time performance. The technical solution of this application reduces the number of Flash writes, thereby reducing the terminal's load and preventing performance degradation due to storage operations. This results in better performance for terminals in scenarios requiring high concurrency, such as real-time data acquisition and communication.
[0093] Embodiments of the present invention also provide a terminal 100, such as Figure 4 As shown, the terminal 100 includes a memory 101 and a processor 102. The memory 101 is used to store computer programs executable by the processor 102; the processor 102 is used to execute the computer programs in the memory 101 to implement the data reading and writing method of the terminal provided in any of the above embodiments.
[0094] Figure 4 The terminal 100 shown also includes a communication interface 103. The processor 102, memory 101, and communication interface 103 are connected via a communication bus and communicate with each other.
[0095] Processor 102 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits used to control the execution of the above scheme program.
[0096] Communication interface 103 is used to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Networks (WLAN), etc.
[0097] Memory 101 may be a read-only memory (ROM) or other type of static storage device capable of storing static information and instructions, random access memory (RAM) or other type of dynamic storage device capable of storing information and instructions, or electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital versatile optical discs, Blu-ray discs, etc.), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto. Memory may exist independently and be connected to the processor via a bus. Memory may also be integrated with the processor.
[0098] Embodiments of the present invention also provide a computer-readable storage medium storing instructions that, when executed on an electronic device, cause the electronic device to perform the data read / write method of the terminal provided in any of the above embodiments.
[0099] Embodiments of the present invention also provide a computer program product, the computer program product including instructions, which, when executed by one or more processors, are used to implement the data reading and writing method of the terminal as provided in any of the above embodiments.
[0100] Various embodiments of the mechanisms disclosed in this invention can be implemented in hardware, software, firmware, or combinations of these implementations. Embodiments of this invention can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memories and / or storage elements), at least one input device, and at least one output device.
[0101] It should be noted that the units / modules mentioned in the various device embodiments of the present invention are all logical units / modules. Physically, a logical unit / module can be a physical unit / module, a part of a physical unit / module, or a combination of multiple physical units / modules. The physical implementation of these logical units / modules themselves is not the most important factor; the combination of functions implemented by these logical units / modules is the key to solving the technical problem proposed by the present invention. Furthermore, to highlight the innovative aspects of the present invention, the above-described device embodiments of the present invention have not introduced units / modules that are not closely related to solving the technical problem proposed by the present invention. This does not mean that the above-described device embodiments do not contain other units / modules.
[0102] It should be noted that in the examples and description of this patent, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0103] Although the invention has been illustrated and described with reference to certain preferred embodiments thereof, those skilled in the art will understand that various changes in form and detail may be made therein without departing from the spirit and scope of the invention.
Claims
1. A method for reading and writing data on a terminal, characterized in that, The terminal includes Flash memory, which includes multiple NV storage areas, each of which is used to store corresponding NV data. The method includes: The startup state of the terminal is determined, and a reading strategy for reading NV data from at least a portion of the NV storage area of the Flash is determined based on the startup state of the terminal. Specifically, the reading strategy enables the terminal to adopt different reading strategies for different NV storage areas under different startup states, thereby reducing unnecessary reading operations and avoiding excessive wear of some storage areas in the Flash. The NV storage areas are divided according to the frequency of change of the NV data corresponding to the NV storage areas during the operation of the terminal. The mobile state of the terminal is determined, and a write strategy is determined based on the mobile state of the terminal to write at least some parameters in the NV data into at least a portion of the NV storage area of the Flash. Specifically, the write strategy enables the terminal to adopt different write strategies under different mobile states, thereby reducing unnecessary write operations to the Flash without affecting the terminal's services. The write operation when writing at least some parameters into at least a portion of the NV storage area of the Flash is at least partially triggered by a set trigger event.
2. The data reading and writing method for a terminal according to claim 1, characterized in that, The plurality of NV storage areas include a first NV storage area, a second NV storage area, a third NV storage area, and a fourth NV storage area, wherein the first NV storage area is used to store first NV data, the second NV storage area is used to store second NV data, the third NV storage area is used to store third NV data, and the fourth NV storage area is used to store fourth NV data.
3. The terminal data reading and writing method according to claim 2, characterized in that, The terminal's startup states include power-on, deep sleep wake-up, and soft boot. Determining the read strategy for reading NV data from at least a portion of the NV storage area of the Flash memory based on the terminal's startup state includes: When the terminal is powered on, it is determined that first NV data is read from the first NV storage area of the Flash and third NV data is read from the third NV storage area of the Flash into the memory of the terminal; In the case of the terminal waking from deep sleep, it is determined that first NV data is read from the first NV storage area of the Flash, third NV data is read from the third NV storage area of the Flash, and fourth NV data is read from the fourth NV storage area of the Flash into the memory of the terminal; In the case of soft power-on of the terminal, the first NV data and the third NV data read into the memory when the terminal is powered on remain unchanged.
4. The terminal data reading and writing method according to claim 3, characterized in that, The first NV data includes: radio frequency calibration parameters, network access parameters, device identification and authentication information, and configuration information; The second NV data includes: the terminal's dynamic context information; The third NV data includes: the terminal's dynamically configurable network management information; The fourth NV data includes: data that needs to be saved when the terminal is in deep sleep.
5. The data reading and writing method for a terminal according to claim 3, characterized in that, The method further includes: Determine the extent to which at least some parameters in the NV data affect the recovery of the terminal services; Based on the degree of influence of at least some parameters in the NV data on the recovery of terminal services, at least some parameters in the NV data are classified to obtain core parameters, auxiliary parameters, and non-critical parameters.
6. The data reading and writing method for a terminal according to claim 5, characterized in that, The terminal's movement state includes: stationary state, low-speed movement state, medium-speed movement state, and high-speed movement state; the terminal's movement state is determined based on the number of times the terminal performs cell reselection or cell handover within a set time range; if the number of times the terminal performs cell reselection or cell handover within the set time range is within a first threshold range, then the terminal's movement state is determined to be stationary or low-speed movement state; if the number of times the terminal performs cell reselection or cell handover within the set time range is within a second threshold range, then the terminal's movement state is determined to be medium-speed movement state; if the number of times the terminal performs cell reselection or cell handover within the set time range exceeds the second threshold range, then the terminal's movement state is determined to be high-speed movement state; wherein, the first threshold is less than the second threshold.
7. The terminal data reading and writing method according to claim 6, characterized in that, The core parameters include AT command operation fields, candidate frequency point information, RPLMN information, and security context information. The set trigger events include a first trigger event. The step of determining a write strategy for writing at least a portion of the parameters in the NV data to at least a portion of the NV storage area of the Flash based on the movement state of the terminal includes: When the terminal is stationary or moving at low speed For the AT command operation field, a blocking operation is used to write the AT command operation field into the first NV storage area of the Flash in real time; If a first triggering event is detected, the candidate frequency information is written to the third NV storage area of the Flash using a non-blocking operation. When the terminal is in a soft shutdown or deep sleep state, the RPLMN information and security context information are written into the third NV storage area of the Flash memory.
8. The data reading and writing method for a terminal according to claim 7, characterized in that, The method further includes: Monitor power supply voltage; If the power supply voltage is detected to be lower than the set voltage threshold, and it is determined that the terminal is in the process of power failure, then the candidate frequency point information and RPLMN information are written into the third NV storage area of the Flash.
9. The data reading and writing method for a terminal according to claim 7, characterized in that, The auxiliary parameters include cell frequency information, Cell ID, SIB2 code stream, historical frequency information, and measured values. The set trigger events include a second trigger event. The step of determining a write strategy for writing at least a portion of the parameters in the NV data to at least a portion of the NV storage area of the Flash based on the movement state of the terminal includes: If a second triggering event is detected when the terminal is stationary or moving at low speed, the cell frequency information, Cell Id, SIB2 code stream, historical frequency information, and measurement values are written into the third NV storage area of the Flash.
10. The data reading and writing method for a terminal according to claim 9, characterized in that, The non-critical parameters include timer information, temporary measurement reports, and intermediate states. The step of determining a write strategy for writing at least a portion of the parameters in the NV data into at least a portion of the NV storage area of the Flash based on the terminal's movement state includes: When the terminal is stationary or moving at low speed, if it is determined that the logical storage unit corresponding to the second NV storage area in the terminal needs to be powered down, the timer information, temporary measurement report and intermediate state are written into the second NV storage area of the Flash before the logical storage unit is powered down.
11. The data reading and writing method for a terminal according to claim 10, characterized in that, The step of determining a write strategy for writing at least a portion of the parameters in the NV data to at least a portion of the NV storage area of the Flash based on the movement state of the terminal further includes: When the terminal is in a medium-speed or high-speed moving state For the case of cell reselection within the same frequency band of the terminal, if the terminal's TAU process is triggered, then when the TAU process ends and a second triggering event occurs, at least some of the core parameters and auxiliary parameters are written into the corresponding NV storage area in the Flash. For the case of cell reselection within the same frequency band of the terminal, if the terminal's TAU process is not triggered, then before the terminal is powered off or when the second triggering event occurs, at least some of the core parameters and auxiliary parameters are written into the corresponding NV storage area in the Flash. For inter-frequency cell reselection of the terminal, if the terminal's TAU procedure is triggered, then when the TAU procedure ends and a second triggering event occurs, at least some of the core parameters and auxiliary parameters are written into the corresponding NV storage area in the Flash. For inter-frequency cell reselection of the terminal, if the terminal's TAU procedure is not triggered, the candidate frequency information in the core parameters is updated, and before the terminal is powered off or when the second triggering event occurs, at least some of the updated core parameters and at least some of the auxiliary parameters are written into the corresponding NV storage area in the Flash. In the event of a connection state switch of the terminal, at least some of the core parameters and auxiliary parameters are written into the corresponding NV storage area in the Flash.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores instructions that, when executed on an electronic device, cause the electronic device to perform the data read / write method of the terminal as described in any one of claims 1 to 11.
13. A computer program product, characterized in that, The computer program product includes instructions that, when executed by one or more processors, implement the data read / write method of the terminal as described in any one of claims 1 to 11.
14. A terminal, characterized in that, include: Memory, used to store instructions, and One or more processors, when the instructions are executed by the one or more processors, the processors perform the data read / write method of the terminal as described in any one of claims 1 to 11.
Citation Information
Patent Citations
Mobile terminal, power supply management chip restart detection processing method and storage medium
CN108152706A
Method and device for household appliance operation control and household appliance
CN115524979A