Data processing method of electronic equipment, electronic equipment and storage medium
By adaptively determining the size of the data holding area in the internal memory of the electronic device, the sleep delay and invalid power consumption problems caused by fixed-sized areas are solved, and more efficient power consumption management and response speed are achieved.
Patent Information
- Application Number
- CN202311531625.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-15
- Publication Date
- 2025-05-16
AI Technical Summary
When existing electronic devices are in sleep mode, fixed-size data retention areas lead to sleep delay caused by excessive migration data, and when the actual data retention is smaller than the fixed-size, some useless data retention areas cause additional power consumption.
By responding to the sleep instruction by the firmware in the internal memory, the data holding area size of the data to be retained is adaptively determined, the target data holding area is determined in the internal memory according to the size of the data to be retained, and the migrated data is stored to the external memory.
Improve the adverse effects caused by fixed-sized data retention areas, reduce sleep delay and invalid power consumption, and improve the power consumption efficiency and wake-up response speed of electronic devices.
Smart Images

Figure CN120010931A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a data processing method for an electronic device, an electronic device, and a storage medium. Background Art
[0002] Electronic devices play an indispensable role in manufacturing, communications, healthcare, commerce, social interaction and entertainment. With the widespread use of electronic devices, the power consumed by electronic devices has also increased rapidly, and the increase in power consumption will lead to increased heat generation and reduced reliability of electronic devices.
[0003] In order to reduce the power consumption of electronic devices, low power consumption design is usually adopted in the design process of electronic devices. For example, if the electronic device does not need to be operated for a short period of time, the electronic device will enter a sleep mode.
[0004] In the related art, when an electronic device enters a sleep mode, a storage area of a fixed size is protected from power failure so as to use the storage area to store relevant data. Summary of the invention
[0005] The present application provides a data processing method of an electronic device, an electronic device and a storage medium, which utilizes firmware in an internal memory to adaptively determine the size of a corresponding data retention area according to the data size of the data to be retained, thereby improving the adverse effects caused by a fixed-size data retention area in the related art.
[0006] In order to solve the above technical problems, the present application provides, on the one hand, a data processing method for an electronic device, the electronic device comprising at least a controller, an internal memory and an external memory, the data processing method comprising: the firmware in the internal memory determines the data to be retained and the migrated data in the internal memory in response to a hibernation instruction sent by the controller; the firmware determines a target data retention area in the internal memory based on the data to be retained; wherein the size of the target data retention area is positively correlated with the size of the data to be retained and is smaller than the total capacity of the internal memory; the firmware retains the data to be retained in the target data retention area, and stores the migrated data to the external memory, thereby completing the hibernation of the electronic device.
[0007] In some embodiments, the firmware determines a target data retention area in the internal memory based on the data to be retained, including: the firmware obtains data information corresponding to the data to be retained; wherein the data information includes data size and / or data location; the firmware determines the target data retention area in the internal memory based on the data size and / or data location.
[0008] In some embodiments, after determining the target data retention area in the internal memory, it includes: the firmware sets the register value corresponding to the target data retention area to a first mark value; and the firmware sets the register value corresponding to the non-target data retention area in the internal memory to a second mark value; wherein the first mark value is used to indicate that the corresponding area remains powered on when the electronic device is in sleep mode; and the second mark value is used to indicate that the corresponding area is powered off when the electronic device is in sleep mode.
[0009] In some embodiments, determining the data to be retained and the data to be migrated in the internal memory includes: obtaining a usage scenario of the electronic device; and determining the data to be retained and the data to be migrated in the internal memory according to the usage scenario.
[0010] In some embodiments, data to be retained and data to be migrated in an internal memory are determined based on a usage scenario, including: in response to the usage scenario being a low power consumption scenario, first data to be retained and first migrated data in the internal memory are determined; in response to the usage scenario being a high response scenario, second data to be retained and second migrated data in the internal memory are determined; wherein the amount of data of the second data to be retained is greater than the amount of data of the first data to be retained.
[0011] In some embodiments, the firmware in the internal memory determines the data to be retained and the data to be migrated in the internal memory in response to a sleep instruction sent by the controller, including: the firmware determines the amount of current data in the internal memory in response to the sleep instruction sent by the controller; and determines the data to be retained and the data to be migrated in the internal memory based on the amount of current data.
[0012] In some embodiments, based on the data volume of current data, the data to be retained and the data to be migrated in the internal memory are determined, including: in response to the data volume of the current data being greater than a first data volume threshold, third data to be retained and third migrated data in the internal memory are determined; in response to the data volume of the current data being less than or equal to the first data volume threshold, fourth data to be retained and fourth migrated data in the internal memory are determined; wherein the data volume of the third data to be retained is greater than the data volume of the fourth data to be retained.
[0013] In some embodiments, the firmware determines a target data retention area in an internal memory based on the data to be retained, including: in response to the data volume of the data to be retained being greater than a second data volume threshold, adding a default data retention area to obtain a target data retention area; wherein the data volume corresponding to the default data retention area is equal to the second data volume threshold; in response to the data volume of the data to be retained being less than or equal to the second data volume threshold, reducing the default data retention area to obtain a target data retention area.
[0014] In order to solve the above technical problems, the present application provides an electronic device on the other hand, which includes at least a controller, an internal memory and an external memory. The controller, the internal memory and the external memory cooperate with each other to implement the data processing method of the above electronic device.
[0015] In order to solve the above technical problem, the present application provides a computer-readable storage medium on the other hand, which stores a computer program. When the computer program is executed by a processor, it is used to implement the data processing method of the above electronic device.
[0016] The data processing method of the electronic device provided in some embodiments of the present application utilizes the firmware in the internal memory to adaptively determine the size of the corresponding data retention area according to the data size of the data to be retained, so as to improve the adverse effects caused by the fixed-size data retention area in the related technology, such as the sleep delay caused by too much data needing to be migrated to the external memory, and when the actual retained data is smaller than the fixed-size data retention area, some useless data retention areas will also generate additional power consumption and other problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0018] Figure 1 is a flowchart of a data processing method in some embodiments of the present application;
[0019] Figure 2 is a flowchart of a data processing method in some embodiments of the present application;
[0020] Figure 3 is a flowchart of a data processing method in some embodiments of the present application;
[0021] Figure 4 is a flowchart of a data processing method in some embodiments of the present application;
[0022] Figure 5 is a flowchart of a data processing method in some embodiments of the present application;
[0023] Figure 6 is a flowchart of a data processing method in some embodiments of the present application;
[0024] Figure 7 is the intention of the electronic device in some embodiments of the present application;
[0025] Figure 8 is a schematic diagram of a computer-readable storage medium in some embodiments of the present application. DETAILED DESCRIPTION
[0026] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0027] See also Figure 1 , Figure 1 It is a flow chart of a data processing method in some embodiments of the present application, which is applied to an electronic device, and the electronic device at least includes a controller, an internal memory and an external memory.
[0028] In some embodiments, the electronic device may be a smart phone, a desktop computer, a smart wearable device or other, which is not limited here. The controller may be a main control chip or other control module with decision-making function, which is not limited here. The internal memory may be a memory; the external memory may be a solid state drive, a floppy disk, an optical disk, a USB flash drive or other, which is not limited here.
[0029] The data processing method in some embodiments of the present application may include the following steps:
[0030] Step 11: The firmware in the internal memory determines the data to be retained and the data to be migrated in the internal memory in response to the sleep instruction sent by the controller.
[0031] In some embodiments, the controller determines whether it needs to issue a sleep instruction based on the real-time state, usage behavior, working process or other methods of the electronic device. For example, it is determined whether the real-time state of the electronic device needs to be shut down and / or in sleep mode, and if so, the controller issues a sleep instruction. For another example, it is determined whether the working process of the electronic device within a preset time is completed or about to be completed, and if so, the controller issues a sleep instruction. For another example, it is determined whether the electronic device needs to reduce power consumption, and if so, the controller issues a sleep instruction.
[0032] In some embodiments, the data to be retained may be data to avoid loss when the electronic device is in sleep mode, or may be necessary data for waking up the electronic device after the electronic device has been in sleep mode, or other data, which is not limited here.
[0033] In some embodiments, the migration data may be data that will be lost when the electronic device is in sleep mode, or data that the user needs to retain, which is not limited here.
[0034] In some embodiments, the data to be retained and the data to be migrated can be determined based on user needs. Specifically, the user issues an instruction to traverse the internal memory to determine the data to be retained from the internal memory, and determine other data in the internal memory except the data to be retained as the migrated data.
[0035] In some embodiments, the data to be retained and the data to be migrated may be determined based on the usage scenario of the electronic device. Specifically, the usage scenario of the electronic device is acquired, and then the data to be retained and the data to be migrated in the internal memory are determined according to the usage scenario.
[0036] In some embodiments of the present application, the usage scenario can be determined by user instructions and / or operations, and the usage scenario may include a low power consumption scenario, a high response scenario or other scenarios, which are not limited here.
[0037] Among them, the low-power consumption scenario refers to the situation where the power consumption requirement for the electronic device is low; the high-response scenario refers to the situation where the response speed requirement for waking up the electronic device from sleep is high. For example, when the user has high requirements for the power consumption of the electronic device when it is in standby or sleep mode, in order to make the power consumption generated by the electronic device lower, the corresponding usage scenario here can be a low-power consumption scenario. For another example, when the user has low requirements for the power consumption of the electronic device but high requirements for the response speed of waking up the electronic device from sleep mode, in order to obtain a high response speed, the corresponding usage scenario at this time can be a high-response scenario.
[0038] In an application scenario, in response to the use scenario being a low power consumption scenario, first data to be retained and first migration data in the internal memory are determined; in response to the use scenario being a high response scenario, second data to be retained and second migration data in the internal memory are determined. The amount of the second data to be retained is greater than the amount of the first data to be retained.
[0039] It can be understood that the more data to be retained, the more power consumption the electronic device generates; and the less data to be retained, the less power consumption the electronic device generates.
[0040] In some embodiments, the firmware determines the amount of current data in the internal memory in response to the sleep instruction sent by the controller, and then determines the data to be retained and the data to be migrated in the internal memory according to the amount of current data.
[0041] In an application scenario, in response to the data volume of the current data being greater than the first data volume threshold, the third data to be retained and the third migration data in the internal memory are determined; in response to the data volume of the current data being less than or equal to the first data volume threshold, the fourth data to be retained and the fourth migration data in the internal memory are determined. The data volume of the third data to be retained is greater than the data volume of the fourth data to be retained. The size of the first data volume threshold can be determined according to actual conditions.
[0042] For example, the data volume of the current data is 100MB, and the first data volume threshold is 80MB. At this time, the data volume of the current data is greater than the first data volume threshold, and the third data to be retained and the third migration data are determined from the 100MB of data, wherein the data volume of the third data to be retained is less than 100MB, for example, 90MB, 80MB, and 70MB; the data volume of the current data is 70MB, and the first data volume threshold is 80MB. At this time, the data volume of the current data is less than the first data volume threshold, and the fourth data to be retained and the fourth migration data are determined from the 70MB of data, wherein the data volume of the fourth data to be retained is less than 70MB, for example, 60MB and 50MB.
[0043] In some embodiments, the first data volume threshold may be used as a threshold value to determine the size of the data retention area. If the data volume of the current data is greater than the first data volume threshold, the third data to be retained may be directly equal to the first data volume threshold to determine the size of the data retention area.
[0044] In some embodiments, the data to be retained and the data to be migrated in the internal memory are determined according to a memory management algorithm configured in the firmware, wherein the memory management algorithm may mark the data stored in the internal memory, and then determine the data to be retained and the data to be migrated according to the mark.
[0045] It can be understood that, for the same internal memory, the to-be-retained data and the migrated data marked by different memory management algorithms are the same or different.
[0046] Step 12: The firmware determines a target data retention area in the internal memory based on the data to be retained; wherein the size of the target data retention area is positively correlated with the size of the data to be retained and is smaller than the total capacity of the internal memory.
[0047] It can be understood that the target data holding area is used to store data to be retained. When the data to be retained increases / decreases, the target data holding area also needs to increase / decrease accordingly. When the electronic device is in sleep mode, the target data holding area remains powered on. When the target data holding area increases / decreases, the power consumption generated by the electronic device will also increase / decrease accordingly.
[0048] In some embodiments, the firmware obtains data information corresponding to the data to be retained, wherein the data information includes data size and / or data location, and then the firmware determines a target data retention area from the internal memory according to the data size and / or data location.
[0049] In an application scenario, the firmware determines, based on the data size of the data to be retained, an area in the internal memory that is consistent with the data size of the data to be retained, which is the target data retention area.
[0050] In an application scenario, the firmware determines, based on the data location of the data to be retained, an area in the internal memory that is consistent with the data location of the data to be retained, which is the target data retention area.
[0051] In an application scenario, the firmware determines an area in the internal memory that is consistent with the data size and data location of the data to be retained based on the data size and data location of the data to be retained, which is the target data retention area.
[0052] In some embodiments, the target data retention area can be determined by comparing the size relationship between the data volume of the data to be retained and the threshold. Specifically, in response to the data volume of the data to be retained being greater than the second data volume threshold, the default data retention area is increased to obtain the target data retention area; in response to the data volume of the data to be retained being less than or equal to the second data volume threshold, the default data retention area is reduced to obtain the target data retention area. The data volume corresponding to the default data retention area is equal to the second data volume threshold, and the second data volume threshold can be determined according to actual conditions.
[0053] The default data retention area may be an initial data retention area, or a non-power-off data retention area, such as MB0-MB15 (save 15 bytes), MB300-MB500 (save 200 bytes); the default data retention area may be increased / deleted as required.
[0054] In one application scenario, in the process of migrating migration data to an external memory, if the migration speed is too slow or the power consumption requirement for the electronic device is low, and there is a lot of migration data that has not been written to the external memory, the number of target data retention areas in the internal memory can be adaptively increased, and the newly added target data retention areas correspond to the part of the data that has not been migrated, and then the part of the data that has not been migrated can be stored in the newly added target data retention areas. In the process of migrating migration data to an external memory, if the migration speed is too fast or the power consumption requirement for the electronic device is high, and the capacity of the external memory is much larger than the data volume of the original migration data, when most of the migration data is written into the external memory, the number of target data retention areas in the internal memory can be adaptively reduced, part of the original data to be retained is determined as new migration data, and the new migration data is migrated to the external memory, so as to increase the number of power-off areas in the electronic device, reduce the number of non-power-off areas in the electronic device, reduce power consumption, and improve the wake-up response speed of the electronic device, so as to achieve a balance between power consumption and wake-up response speed.
[0055] In some embodiments, after determining the target data retention area from the internal memory, the firmware may set the register value corresponding to the target data retention area to a first tag value; and the firmware sets the register value corresponding to the non-target data retention area in the internal memory to a second tag value. The first tag value is used to indicate that the corresponding area remains powered on when the electronic device is in sleep mode, and the second tag value is used to indicate that the corresponding area is powered off when the electronic device is in sleep mode.
[0056] In an application scenario, the first tag value is 1, indicating that the corresponding area is not powered off when the electronic device is in sleep mode; the second tag value is 0, indicating that the corresponding area is powered off when the electronic device is in sleep mode.
[0057] It can be understood that the specific values of the first tag value and the second tag value can be determined according to actual conditions and are not limited here.
[0058] In some embodiments, the first tag value and the second tag value are both register values, and the memory in the internal memory can be partitioned, and each area is identified by a register value. If the area is a target data holding area, the corresponding register value can be set to the first tag value, and if the area is not the target data holding area, the corresponding register value can be set to the second identification value.
[0059] It can be understood that when partitioning the memory in the internal storage, the memory in the internal storage can be divided into a number of regions of equal size, or the memory in the internal storage can be divided into a number of regions of inconsistent size.
[0060] For example, the memory size of the internal memory is 1MB, and 32KB is used as the partition basis to divide 1MB into 32 areas with a memory size of 32KB. Each area is controlled by a bit value. If the area is the target data holding area, the corresponding bit value is set to 1. If the area is not the target data holding area, the corresponding bit value is set to 0.
[0061] For example, the memory size of the internal memory is 1MB, which can be divided into 16 areas with a memory size of 32KB and 16 areas with a memory size of 64KB. Each area is controlled by a bit value. If area 1 to area 15 are target data holding areas, the bit values corresponding to area 1 to area 15 are set to 1. If area 1 to area 15 are not target data holding areas, the bit values corresponding to area 1 to area 15 are set to 0.
[0062] Step 13: The firmware retains the data to be retained in the target data retention area, and stores the migrated data in the external memory, thereby completing the hibernation of the electronic device.
[0063] The data processing method of the electronic device provided in some embodiments of the present application uses firmware to adaptively determine the size of the corresponding data retention area according to the data size of the data to be retained. Compared with the related art, the target data retention area is fixed. The present application can improve the adverse effects caused by the fixed-size data retention area in the related art, such as the sleep delay caused by too much data that needs to be migrated to the external memory, and when the actual retained data is smaller than the fixed-size data retention area, some useless data retention areas will also generate additional power consumption. The technical solution of the present application is more practical and extensible, and can better meet the needs of users.
[0064] See also Figure 2 , Figure 2 It is a flowchart of a data processing method in some embodiments of the present application, which is applied to an electronic device, the electronic device at least includes a controller, an internal memory and an external memory, and the data processing method includes the following steps:
[0065] Step 21: The firmware in the internal memory determines the data to be retained and the data to be migrated in the internal memory in response to the sleep instruction sent by the controller.
[0066] Step 22: The firmware determines a target data retention area in the internal memory based on the data to be retained; wherein the size of the target data retention area is positively correlated with the size of the data to be retained and is smaller than the total capacity of the internal memory.
[0067] Step 23: The firmware sets the register value corresponding to the target data holding area to a first tag value; and the firmware sets the register value corresponding to the non-target data holding area in the internal memory to a second tag value; wherein the first tag value is used to indicate that the corresponding area remains powered on when the electronic device is in sleep mode, and the second tag value is used to indicate that the corresponding area is powered off when the electronic device is in sleep mode.
[0068] Step 24: The firmware retains the data to be retained in the target data retention area, and stores the migrated data in the external memory, thereby completing the hibernation of the electronic device.
[0069] The data processing method of the electronic device provided in some embodiments of the present application can store the data to be retained in the internal memory in a targeted manner and migrate the migrated data to the external memory, which can not only meet the needs of users, but also only keep the area corresponding to the data to be retained powered on when the electronic device is dormant, thereby reducing the power consumption of the electronic device. In addition, the register value is used to identify the target data retention area and the non-target data retention area. When adding or deleting the number of target data retention areas, the register value can be directly changed, which is more convenient.
[0070] See also Figure 3 , Figure 3 It is a flowchart of a data processing method in some embodiments of the present application, which is applied to an electronic device, the electronic device at least includes a controller, an internal memory and an external memory, and the data processing method includes the following steps:
[0071] Step 31: The firmware in the internal memory obtains the usage scenario of the electronic device in response to the sleep instruction sent by the controller.
[0072] Step 32: Determine the data to be retained and the data to be migrated in the internal memory according to the usage scenario.
[0073] Step 33: The firmware obtains data information corresponding to the data to be retained; wherein the data information includes data size and / or data location.
[0074] Step 34: The firmware will determine a target data retention area in the internal memory according to the data size and / or data location; wherein the size of the target data retention area is positively correlated with the size of the data to be retained and is smaller than the total capacity of the internal memory.
[0075] In some embodiments, after determining the target data retention area from the internal memory, the firmware may set the register value corresponding to the target data retention area to a first tag value; and the firmware sets the register value corresponding to the non-target data retention area in the internal memory to a second tag value. The first tag value is used to indicate that the corresponding area remains powered on when the electronic device is in sleep mode, and the second tag value is used to indicate that the corresponding area is powered off when the electronic device is in sleep mode.
[0076] Step 35: The firmware retains the data to be retained in the target data retention area, and stores the migrated data in the external memory, thereby completing the hibernation of the electronic device.
[0077] The data processing method of the electronic device provided in some embodiments of the present application can determine the data to be retained and the data to be migrated according to the usage scenario of the electronic device. Not only can the data to be retained and the data to be migrated be determined in a targeted manner, but also only the area corresponding to the data to be retained can be powered on when the electronic device is in sleep mode, thereby reducing the power consumption of the electronic device.
[0078] See also Figure 4 , Figure 4 It is a flowchart of a data processing method in some embodiments of the present application, which is applied to an electronic device, the electronic device at least includes a controller, an internal memory and an external memory, and the data processing method includes the following steps:
[0079] Step 41: The firmware in the internal memory obtains the usage scenario of the electronic device in response to the sleep instruction sent by the controller.
[0080] Step 42: Determine the data to be retained and the data to be migrated in the internal memory according to the usage scenario.
[0081] Step 43: Determine whether the amount of data to be retained is greater than a second data amount threshold.
[0082] If yes, execute step 44, otherwise execute step 45.
[0083] Step 44: Add a default data retention area to obtain a target data retention area; wherein the amount of data corresponding to the default data retention area is equal to the second data amount threshold.
[0084] Step 45: Reduce the default data holding area to obtain a target data holding area.
[0085] The default data holding area may be formed by the factory setting of the memory storage, ie, a data holding area of a fixed size.
[0086] In some embodiments, after determining the target data retention area from the internal memory, the firmware may set the register value corresponding to the target data retention area to a first tag value; and the firmware sets the register value corresponding to the non-target data retention area in the internal memory to a second tag value. The first tag value is used to indicate that the corresponding area remains powered on when the electronic device is in sleep mode, and the second tag value is used to indicate that the corresponding area is powered off when the electronic device is in sleep mode.
[0087] Step 46: The firmware retains the data to be retained in the target data retention area, and stores the migrated data in the external memory, thereby completing the hibernation of the electronic device.
[0088] The data processing method of the electronic device provided in some embodiments of the present application can determine the data to be retained and the data to be migrated according to the use scenario of the electronic device. Not only can the data to be retained and the data to be migrated be determined in a targeted manner, but also only the area corresponding to the data to be retained can be powered on when the electronic device is dormant, thereby reducing the power consumption of the electronic device. In addition, by judging the relationship between the amount of the data to be retained and the threshold, it can be determined whether the number of target data retention areas needs to be added or deleted, which is more convenient.
[0089] See also Figure 5 , Figure 5 It is a flowchart of a data processing method in some embodiments of the present application, which is applied to an electronic device, the electronic device at least includes a controller, an internal memory and an external memory, and the data processing method includes the following steps:
[0090] Step 51: The firmware determines the amount of current data in the internal storage in response to the sleep instruction sent by the controller.
[0091] Step 52: Determine the data to be retained and the data to be migrated in the internal memory according to the amount of current data.
[0092] Step 53: The firmware obtains data information corresponding to the data to be retained; wherein the data information includes data size and / or data location.
[0093] Step 54: The firmware will determine a target data retention area in the internal memory according to the data size and / or data location; wherein the size of the target data retention area is positively correlated with the size of the data to be retained and is smaller than the total capacity of the internal memory.
[0094] In some embodiments, after determining the target data retention area from the internal memory, the firmware may set the register value corresponding to the target data retention area to a first tag value; and the firmware sets the register value corresponding to the non-target data retention area in the internal memory to a second tag value. The first tag value is used to indicate that the corresponding area remains powered on when the electronic device is in sleep mode, and the second tag value is used to indicate that the corresponding area is powered off when the electronic device is in sleep mode.
[0095] Step 55: The firmware retains the data to be retained in the target data retention area, and stores the migrated data in the external memory, thereby completing the hibernation of the electronic device.
[0096] The data processing method of an electronic device provided in some embodiments of the present application can determine the data to be retained and the migrated data based on the data volume of the current data, and can determine the target data retention area in a targeted manner based on information such as the data size and / or data location of the data to be retained, which is more in line with actual needs and improves the adverse effects caused by the fixed-size data retention area in related technologies.
[0097] See also Figure 6 , Figure 6 It is a flowchart of a data processing method in some embodiments of the present application, which is applied to an electronic device, the electronic device at least includes a controller, an internal memory and an external memory, and the data processing method includes the following steps:
[0098] Step 61: The firmware determines the amount of current data in the internal storage in response to the sleep instruction sent by the controller.
[0099] Step 62: Determine the data to be retained and the data to be migrated in the internal memory according to the amount of current data.
[0100] Step 63: Determine whether the amount of data to be retained is greater than a second data amount threshold.
[0101] If yes, execute step 64, otherwise execute step 65.
[0102] Step 64: Add a default data retention area to obtain a target data retention area; wherein the amount of data corresponding to the default data retention area is equal to the second data amount threshold.
[0103] Step 65: Reduce the default data holding area to obtain a target data holding area.
[0104] In some embodiments, after determining the target data retention area from the internal memory, the firmware may set the register value corresponding to the target data retention area to a first tag value; and the firmware sets the register value corresponding to the non-target data retention area in the internal memory to a second tag value. The first tag value is used to indicate that the corresponding area remains powered on when the electronic device is in sleep mode, and the second tag value is used to indicate that the corresponding area is powered off when the electronic device is in sleep mode.
[0105] Step 66: The firmware retains the data to be retained in the target data retention area, and stores the migrated data in the external memory, thereby completing the hibernation of the electronic device.
[0106] The data processing method of the electronic device provided in some embodiments of the present application can determine the data to be retained and the migrated data according to the data volume of the current data, and adaptively determine the target data retention area according to the data size and / or data location of the data to be retained, which is more in line with actual needs. In addition, by judging the relationship between the data volume of the data to be retained and the threshold, it is determined whether the number of target data retention areas needs to be added or deleted. The dynamic adjustment method makes the entire process more convenient and improves the adverse effects caused by the fixed-size data retention area in the related technology.
[0107] See also Figure 7 , Figure 7 This is the intention of the electronic device in some embodiments of the present application. The electronic device 10 includes at least a controller 101, an internal memory 102 and an external memory 103. The controller 101, the internal memory 102 and the external memory 103 cooperate with each other to implement the data processing method described in any of the above embodiments, which will not be repeated here.
[0108] In some embodiments, the electronic device 10 may further include a processor, a system on chip (SoC), etc., which is not limited here.
[0109] See also Figure 8 , Figure 8 It is a schematic diagram of a computer-readable storage medium in some embodiments of the present application. The computer-readable storage medium 20 is used to store a computer program 201. When the computer program 201 is executed by a processor, it is used to implement the data processing method described in any of the above embodiments, which will not be repeated here.
[0110] The processor involved in this application may be called a CPU (Central Processing Unit), which may be an integrated circuit chip, or a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0111] The storage media used in this application include various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), or a CD.
[0112] To sum up, the data processing method of the electronic device 10 provided in some embodiments of the present application can specifically save the data to be retained in the internal memory and migrate the migration data to the external memory, which can not only meet the needs of users, but also maintain power on only the area corresponding to the data to be retained when the electronic device is in sleep mode, thereby reducing the power consumption of the electronic device.
[0113] The above description is only an implementation method of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A data processing method for an electronic device, characterized in that: The electronic device at least includes a controller, an internal memory and an external memory, and the data processing method includes: The firmware in the internal memory determines the data to be retained and the data to be migrated in the internal memory in response to the sleep instruction sent by the controller; The firmware determines a target data retention area in the internal memory based on the data to be retained; wherein the size of the target data retention area is positively correlated with the size of the data to be retained and is smaller than the total capacity of the internal memory; The firmware retains the to-be-retained data in the target data retaining area and stores the migrated data in the external memory, thereby completing the hibernation of the electronic device.
2. The method according to claim 1, characterized in that The firmware determines a target data retention area in the internal memory based on the data to be retained, including: The firmware obtains data information corresponding to the data to be retained; wherein the data information includes data size and / or data location; The firmware will determine a target data holding area in the internal memory according to the data size and / or the data location.
3. The method according to claim 1, characterized in that After determining the target data holding area in the internal memory, the method includes: The firmware sets the register value corresponding to the target data holding area to a first mark value; and The firmware sets the register value corresponding to the non-target data holding area in the internal memory to a second mark value; The first tag value is used to indicate that the corresponding area remains powered on when the electronic device is in sleep mode; and the second tag value is used to indicate that the corresponding area is powered off when the electronic device is in sleep mode.
4. The method according to claim 1, characterized in that: The determining the data to be retained and the data to be migrated in the internal memory includes: Acquire a usage scenario of the electronic device; The data to be retained and the data to be migrated in the internal memory are determined according to the usage scenario.
5. The method according to claim 4, characterized in that The determining the data to be retained and the data to be migrated in the internal memory according to the usage scenario includes: In response to the usage scenario being a low power consumption scenario, determining first to-be-retained data and first migration data in the internal memory; In response to the usage scenario being a high-response scenario, determining second data to be retained and second data to be migrated in the internal memory; The amount of the second data to be retained is greater than the amount of the first data to be retained.
6. The method according to claim 1, characterized in that The firmware in the internal memory determines the data to be retained and the data to be migrated in the internal memory in response to the sleep instruction sent by the controller, including: The firmware determines the amount of current data in the internal storage in response to the sleep instruction sent by the controller; According to the data amount of the current data, the data to be retained and the data to be migrated in the internal memory are determined.
7. The method according to claim 6, characterized in that The step of determining the data to be retained and the data to be migrated in the internal memory according to the amount of the current data includes: In response to the data amount of the current data being greater than a first data amount threshold, determining third to-be-retained data and third migration data in the internal memory; In response to the data amount of the current data being less than or equal to the first data amount threshold, determining fourth to-be-retained data and fourth migration data in the internal memory; The amount of the third data to be retained is greater than the amount of the fourth data to be retained.
8. The method according to claim 1, characterized in that The firmware determines a target data retention area in the internal memory based on the data to be retained, including: In response to the data volume of the to-be-retained data being greater than a second data volume threshold, adding a default data retention area to obtain the target data retention area; wherein the data volume corresponding to the default data retention area is equal to the second data volume threshold; In response to the data amount of the to-be-retained data being less than or equal to the second data amount threshold, the default data retention area is reduced to obtain the target data retention area.
9. An electronic device, characterized in that: The electronic device at least includes a controller, an internal memory and an external memory, and the controller, the internal memory and the external memory cooperate with each other to implement the method described in any one of claims 1-8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the computer program is used to implement the method according to any one of claims 1 to 8.