Data read-write method, electronic device, program product, and readable medium

By detecting the connection status between the processor and the embedded controller, the problem of input/output request packet timeout when electronic devices are powered off is solved, ensuring the integrity of the data read/write process and preventing device shutdown failure.

CN119336673BActive Publication Date: 2026-03-27HONOR DEVICE CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

During the shutdown process of an electronic device, when the processor reads the NTC temperature value stored in the embedded controller via I2C, it is easy to cause the input/output request packet to time out, resulting in the device shutdown failure.

Method used

By detecting the connection status between the processor and the embedded controller, data reading is avoided during the shutdown process. The shutdown process is completed using indication information, ensuring the integrity of the data read and write process.

Benefits of technology

This effectively avoids data reading failures due to device shutdown, prevents input/output request packet timeouts, and ensures normal shutdown of electronic devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119336673B_ABST
    Figure CN119336673B_ABST
Patent Text Reader

Abstract

The application provides a data read-write method, an electronic device, a program product and a readable medium. The electronic device comprises a first processor and a second processor, and the first processor and the second processor communicate data through a first interface. The method comprises: when the electronic device is in a charging state, the first processor acquires a first temperature value stored by the second processor through the first interface, and adjusts a charging current of the electronic device based on the first temperature value; and during the charging process, when the first processor detects that the electronic device is triggered to shut down, the first processor executes a shutdown process of the electronic device based on indication information. During the charging process of the electronic device, when the first processor detects that the electronic device is triggered to shut down, the first processor can complete the shutdown process of the electronic device based on the indication information, thereby avoiding the problem of IRP timeout caused by the fact that, due to the shutdown of the electronic device, no return message is returned to the data read by the first processor through the first interface.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and particularly relates to a data read-write method, an electronic device, a computer program product and a computer readable storage medium. BACKGROUND

[0002] In a charging process of the electronic device, the processor can set a charging current of the battery based on a temperature value of an NTC thermistor (referred to as an NTC temperature value). The processor can obtain the NTC temperature value from an embed controller (EC) through an advanced configuration and power interface (ACPI). The ACPI and the EC perform data communication based on I2C.

[0003] Before the electronic device enters an off state, if the ACPI is reading the NTC temperature value stored by the EC through I2C, the off of the electronic device causes an input / output request packet (IRP) timeout problem of the electronic device. SUMMARY

[0004] The present application provides a data read-write method, an electronic device, a computer program product and a computer readable storage medium, which can solve the IRP timeout problem of the electronic device caused by the off of the electronic device in the process of writing the NTC temperature value on the EC side into the processor.

[0005] In order to achieve the above-mentioned purpose, the present application provides the following technical solutions:

[0006] In a first aspect, the present application provides a data read-write method applied to an embedded electronic device, the electronic device comprising a first processor and a second processor, the first processor and the second processor performing data communication through a first interface; the data read-write method comprising: when the electronic device is in a charging state, the first processor obtains a temperature value stored by the second processor through the first interface, and adjusts a charging current of the electronic device based on the temperature value, the temperature value being used to indicate a temperature of the electronic device; in a charging process of the electronic device, the first processor detects that the electronic device is triggered to be off, and then executes an off process of the electronic device based on indication information, the indication information being used to indicate that an operation of the first processor to obtain a first temperature value through the first interface is executed.

[0007] It can be seen from the above that, in the charging process of the electronic device, the first processor detects that the electronic device is triggered to be powered off, that is, enters an S5 state, and the first processor can complete a power-off process of the electronic device based on the indication information, thereby avoiding the problem of IRP timeout caused by the fact that, in the process of writing the NTC temperature value on the EC side into the processor, no return message is returned for the data read by the first processor through the first interface due to the power-off of the electronic device. It can be understood that the indication information is a return message for the data read by the first processor through the first interface.

[0008] Based on the first aspect, in a possible implementation, after the first processor detects that the electronic device is triggered to be powered off in the charging process of the electronic device, the first processor further sets a first flag to a second value. The first processor sets the first flag to the second value, for example, False, to indicate that the electronic device is not in a normal state, that is, enters a powered-off state.

[0009] Based on the first aspect, in a possible implementation, the first processor detecting that the electronic device is triggered to be powered off includes: the first processor detecting, based on the instruction for acquiring the temperature value, whether the connection between the second processor and the first interface is disconnected; and the first processor detecting that the connection between the second processor and the first interface is disconnected.

[0010] In this implementation, before the first processor acquires the temperature value based on the instruction for acquiring the temperature value, the first processor first detects whether the connection between the second processor and the first interface is disconnected, to determine whether the electronic device is triggered to be powered off. When the connection between the second processor and the first interface is disconnected, the first processor can complete the power-off process of the electronic device based on the indication information, and can also avoid the problem of IRP timeout caused by the fact that, in the process of writing the NTC temperature value on the EC side into the processor, no return message is returned for the data read by the first processor through the first interface due to the power-off of the electronic device.

[0011] In some embodiments, the first processor detects, based on the instruction for acquiring the temperature value, that the connection between the second processor and the second interface is not disconnected, and then the first processor reads the temperature value stored by the second processor through the first interface. The first processor can read the temperature value in the following manner: reading the temperature value at intervals of a certain time length.

[0012] Based on the first aspect, in a possible implementation, before the first processor detects, based on the instruction for acquiring the temperature value, whether the connection between the second processor and the first interface is disconnected, the first processor further determines that a first flag is a first value. The first value is used to indicate that the electronic device is in a normal state, for example, True.

[0013] In a possible implementation of the first aspect, the detecting whether the connection of the second processor to the first interface is disconnected comprises: detecting, by the first processor, whether the first parameter indicates that the connection of the second processor to the first interface is disconnected.

[0014] In a possible implementation of the first aspect, the electronic device further comprises a third processor, and the first processor and the third processor perform data communication through a second interface. The method further comprises: in a case where the third processor transmits the first data to the first processor through the second interface, the third processor detects that the electronic device enters the low-power-consumption state, and the third processor stops transmitting the first data to the first processor through the second interface.

[0015] In the implementation, the third processor can be an MCU of the pressure-sensitive touch panel. In a case where the third processor transmits the first data to the first processor through the second interface, the third processor detects that the electronic device enters the low-power-consumption state, and the third processor stops transmitting the first data to the first processor through the second interface, which can avoid the problem that the second interface cannot be closed due to data transmission, and thus the IRP timeout problem occurs when the electronic device enters the low-power-consumption state.

[0016] In a possible implementation of the first aspect, the first data refers to the metering data of the third processor. In some embodiments, the metering data comprises: system logs and dotting data.

[0017] In a possible implementation of the first aspect, the method further comprises: in response to the electronic device entering the low-power-consumption state, closing, by the first processor, the second interface.

[0018] In a possible implementation of the first aspect, the method further comprises: in response to the electronic device entering the normal state from the low-power-consumption state, transmitting, by the third processor, the first data to the first processor through the second interface. The first data is data that is not successfully transmitted when the third processor transmits data to the first processor through the second interface. Based on this, when the electronic device enters the normal state from the low-power-consumption state, the third processor transmits the first data to the first processor through the second interface, which can realize transmission of the data that is not transmitted to the first processor again.

[0019] In a possible implementation of the first aspect, before the third processor transmits the first data to the first processor through the second interface, the method further comprises: opening, by the first processor, the second interface, and configuring a parameter of the second interface.

[0020] In a second aspect, the present application provides an electronic device, comprising: a plurality of processors, a memory, the plurality of processors comprising a first processor, a second processor and a third processor; the memory being coupled with the plurality of processors, the memory being configured to store computer program codes, the computer program codes comprising computer instructions, when the plurality of processors execute the computer instructions, the electronic device performs the data read-write method according to any one of the first aspect.

[0021] In a third aspect, the present application provides a computer readable storage medium, configured to store a computer program, when the computer program is executed, specifically for implementing the data read-write method according to any one of the first aspect.

[0022] In a fourth aspect, the present application provides a computer readable storage medium, configured to store a computer program, when the computer program is executed, specifically for implementing the data read-write method according to any one of the first aspect. BRIEF DESCRIPTION OF DRAWINGS

[0023] Figure 1 An architecture diagram of SOC reading NTC temperature value provided by the embodiment of the present application;

[0024] Figure 2 A hardware structure diagram of the electronic device provided by the embodiment of the present application;

[0025] Figure 3 A software structure diagram of the electronic device provided by the embodiment of the present application;

[0026] Figure 4 A timing diagram of the data read-write method provided by the embodiment of the present application;

[0027] Figure 5 An illustration of IRP timeout problem of the housekeeping application reading the maintenance data of MCU;

[0028] Figure 6 A timing diagram of the data read-write method provided by another embodiment of the present application. DETAILED DESCRIPTION

[0029] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. The terms used in the following embodiments are only for the purpose of describing the specific embodiments and are not intended to be limiting to the present application. As used in the specification and the appended claims of the present application, the singular forms “a,” “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms “one or more” as used in the embodiments of the present application means one, two or more than two; “and / or” describes the association relationship of the associated objects, which means that there can be three relationships; for example, A and / or B can represent the following three cases: A exists alone, A and B exist together, and B exists alone, where A and B can be singular or plural. The character “ / ” generally represents an “or” relationship between the associated objects.

[0030] In this specification, the reference “one embodiment” or “some embodiments” means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. Thus, the appearances of the phrases “in one embodiment”, “in some embodiments”, “in other embodiments”, “in additional embodiments”, and so on, in various places in the specification are not necessarily all referring to the same embodiment, unless otherwise specifically noted. The terms “comprising”, “including”, “having” and their variants, mean “including but not limited to”, unless otherwise specifically noted.

[0031] The plurality referred to in the embodiments of the present application means greater than or equal to two. It should be noted that in the description of the embodiments of the present application, the terms “first”, “second”, and the like are used only for the purpose of distinguishing the described purposes, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.

[0032] During the charging process, the electronic device usually sets the charging current of the battery based on the temperature value of the NTC thermistor (referred to as NTC temperature value, which is a first temperature value). When the NTC temperature value is high, the charging current of the electronic device is lowered to avoid overheating of the device. The NTC temperature value usually indicates the temperature of the electronic device, and the electronic device can set thermistors at multiple positions to indicate the temperature of multiple regions of the electronic device. For example, the electronic device is a PC, and the PC has thermistors set at three positions, including the position of the SOC (System-on-a-Chip, chip-level system), the position of the Type-C interface, and the position of the keyboard. Moreover, the power management chip (PMIC) can store the NTC temperature value.

[0033] The PC's SOC (for the primary processor) includes an ADSP (audio DSP) module, which has an ARM PC charging module. This ARM PC charging module typically reads the NTC temperature value every 5 seconds and sets the charging current value based on the NTC temperature value. However, the ARM PC charging module cannot directly read the NTC temperature value from the PMIC.

[0034] The reasons were found to be: Figure 1 As shown, the SOC and PMIC communicate via the SPMI0 bus ( Figure 1 The clock and data lines of the SPMI0 bus are shown, but the SPMI0 bus is not enabled. Therefore, the ADSP cannot directly read the NTC temperature value on the PMIC side through the SPMI0 bus.

[0035] To address this, the Embedded Controller (EC) (the second processor) can read and store the temperature value of the thermistor and transmit it to the ADSP via the ACPI (the first interface), a bridge for data communication with the ADSP. However, since the communication between ACPI and EC is based on I2C, and between ACPI and ADSP is via Glink, ACPI cannot actively read the NTC temperature value from the EC and write it to the ADSP. Instead, a driver module in the operating system's (OS) driver layer needs to call ACPI, which then reads the NTC temperature value stored in the EC via I2C and writes it to the ADSP.

[0036] When an electronic device is in operation, if the OS system transitions from S0 (normal) to S5 (shutdown), and the driver module has already called ACPI to read the NTC temperature value stored in the EC via I2C, but because the OS system enters S5, the I2C driver module (also known as ECDriver) is shut down, causing I2C data transmission failure, the data read by ACPI will not be returned and a response timeout will occur. Furthermore, if ACPI calls I2C to read data again, it will result in unprocessed instructions, causing the OS system to experience an IRP (I / O request packets) timeout. The electronic device will then enter the 900E state (the display screen will turn blue), and shutdown will fail.

[0037] Based on this, the embodiment of the present application provides a data read-write method for obtaining the NTC temperature value stored by the EC. The data read-write method can be applied to a PC (personal computer), such as a tablet computer, a personal digital assistant (PDA), a desktop computer, a laptop computer, a notebook computer, an ultra-mobile personal computer (UMPC), a handheld computer, a netbook, and the like. The electronic device belongs to an embedded electronic device.

[0038] Figure 2 An example of the electronic device is provided for the embodiment of the present application.

[0039] As shown in Figure 2 The electronic device 100 can include a processor 110, an internal memory 120, and a display screen 130, and the like.

[0040] It can be understood that the structure shown in the embodiment does not constitute a specific limitation on the electronic device 100. In other embodiments, the electronic device 100 can include more or fewer components than shown, or combine certain components, or split certain components, or different component arrangements. The components shown can be implemented in hardware, software, or a combination of software and hardware.

[0041] The processor 110 can include one or more processing units, for example: the processor 110 can include a central processing unit (CPU), an embedded controller (EC), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, a smart sensor hub, and / or a neural-network processing unit (NPU), and the like. Different processing units can be independent devices or integrated into one or more processors.

[0042] The processor 110 can also have a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can hold instructions or data that the processor 110 has just used or is using repeatedly. If the processor 110 needs to use the instructions or data again, it can call them directly from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thus improving the efficiency of the system.

[0043] The internal memory 120 can be used to store computer executable program codes, which include instructions. The processor 110 performs various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 120. The internal memory 120 can include a program storage area and a data storage area.

[0044] The electronic device can run an operating system on the hardware components shown. Figure 2 The operating system can be, for example The operating system can be, for example The operating system can be, for example The operating system can be, for example

[0045] In some embodiments, the operating system of the electronic device is The operating system can be, for example Figure 3 As shown in FIG. 1, the Linux system can be divided into two layers, from top to bottom, an application (APP) layer and a driver layer, which can also be referred to as a kernel layer (Linux Kernel). The functional modules in the two-layer structure are functional modules running on the SOC. The SOC is also referred to as the first processor.

[0046] The application layer can include a series of application packages. For example, as shown in FIG. 1, the application packages can include, but are not limited to, a housekeeper application. Figure 3

[0047] The kernel layer is the layer between hardware and software. The kernel layer at least includes a driver module, a BIOS module, a BIOS ACPI module, etc. The BIOS module, also referred to as BIOS, is the Basic Input / Output System, which is used to initialize and test hardware components. The BIOS ACPI module, also referred to as BIOS ACPI, is a module for power management implemented in the BIOS. The functions of the driver module, the BIOS ACPI module and the BIOS module can be referred to the corresponding Figure 4 and​Figure 6 the content.

[0048] Figure 3 The hardware layer also includes the EC, the SOC and the MCU of the touchpad, which are three hardware components. The EC is also referred to as a second processor. The MCU of the touchpad is also referred to as a third processor.

[0049] It should be noted that the embodiments of the present application are described by taking the Android operating system as an example, but the basic principles are also applicable to electronic devices based on iOS, Windows and other operating systems. The operating system is taken as an example for description, but the basic principles are also applicable to electronic devices based on iOS, Windows and other operating systems.

[0050] Figure 4 A timing diagram of the data reading method for obtaining the NTC temperature value stored by the EC is shown.

[0051] To facilitate the introduction of the case, the implementation process of obtaining the resistance temperature value in three stages is introduced below. The difference between the three stages lies in the difference in the timing of the electronic device entering the S5 state.

[0052] First stage: the electronic device is in the S0 state and the charging state, and has not entered the S5 state.

[0053] As shown in FIG. 1, the data reading method includes: Figure 4

[0054] S101, the driving module determines that the electronic device is in the AC state and the S0 state, and sets a flag flag to True.

[0055] In some embodiments, the driving module sets a flag flag, and the value of the flag flag can be divided into two, a first value, for example, True, is used to indicate that the electronic device is in the S0 state (normal state) and the AC state, and a second value, for example, Flase, is used to indicate that the electronic device is not in the S0 state, such as in the S5 state (shutdown state), or not in the AC state. The AC state refers to the charging state.

[0056] In other embodiments, the driving module can also set two flags flag, which respectively indicate whether the electronic device is in the AC state and the S0 state. The first flag flag is a first value, for example, True, which is used to indicate that the electronic device is in the AC state, and the first flag flag is a second value, for example, Flase, which is used to indicate that the electronic device is not in the AC state; the second flag flag is a first value, for example, True, which is used to indicate that the electronic device is in the S0 state, and the second flag flag is a second value, for example, Flase, which is used to indicate that the electronic device is not in the S0 state.

[0057] ​The following describes an example in which the driving module sets a flag flag to indicate whether the electronic device is in the S0 state and the AC state.

[0058] The OS system of the electronic device synchronizes with the state of the electronic device, that is, the electronic device is in the S0 state and the AC state, and the OS system of the electronic device can indicate the S0 state and the AC state.

[0059] In some embodiments, the driving module can determine that the electronic device is in the AC state based on a charging event, which can be reported to the driving module by the charging interface or other components of the electronic device when the charging interface accesses a power source.

[0060] In some embodiments, the driving module can determine that the electronic device is in the S0 state based on a power action of the OS system. After the electronic device is powered on, the OS system can generate a power-on power action, so that the driving module can determine that the electronic device enters the S0 state based on the power action.

[0061] S102, the driving module calls the NTC temperature value of the BIOS ACPI module once every 5S based on the flag flag being True.

[0062] As described in step S101, the flag flag is True, indicating that the electronic device is in the S0 state, and the NTC temperature value of the EC side can be normally read, so that the driving module can call the NTC temperature value of the BIOS ACPI module once every 5S. Of course, 5S is only an example, and the BIOS ACPI module can also call the NTC temperature value once based on other time intervals.

[0063] The operation of the driving module to determine that the flag flag is False can be referred to the content of step S109 below, which is not described here.

[0064] In this embodiment, the driving module determines that the flag flag is True, that is, the electronic device is in the S0 state and the AC state, and then calls the NTC temperature value of the BIOS ACPI module once every 5S, which can ensure that the BIOS ACPI module can successfully read the NTC temperature value of the EC through I2C to a certain extent.

[0065] S103, the BIOS ACPI module determines whether the EC is in a disconnected state.

[0066] Before the BIOS ACPI module reads the NTC temperature value of the EC through I2C in response to the call of the driving module, it can further detect whether the EC is in a disconnected state through step S103.

[0067] In the first phase, the electronic device is in the S0 state and the charging state, and therefore, the BIOS ACPI module can determine that the EC is not in the disconnected state, and the electronic device performs steps S104 to S108.

[0068] In some embodiments, the connected state and the disconnected state of the EC can refer to whether the connected I2C of the EC is in the connected state or the disconnected state, that is, the EC can transmit data through the I2C or cannot transmit data through the I2C.

[0069] In some embodiments, the OS system can call the REG method to record the state of the EC and the I2C during the running process. When the OS system calls the REG method to record the state of the EC and the I2C, the parameter arg1 (as the first parameter) can be called to record the state of the EC and the I2C. For example, arg1 is 0, which indicates that the EC is disconnected, that is, the EC cannot be connected to ACPI through the I2C, and arg1 is 1, which indicates that the EC remains connected, that is, the EC can remain connected to ACPI through the I2C. Of course, 1 and 0 are only examples and do not constitute a limitation on the value of the parameter arg1. In this way, the BIOS ACPI module can determine the state of the EC and the I2C based on the value of the parameter arg1.

[0070] It should be noted that in some embodiments, the BIOS ACPI module can also set a flag to record whether the EC is in the connected state or the disconnected state. The value of the flag can be divided into two, the first value, for example, True, is used to indicate that the EC is in the connected state, and the second value, for example, Flase, is used to indicate that the EC is in the disconnected state.

[0071] In the first phase, the electronic device is in the S0 state and the charging state, and therefore, the BIOS ACPI module can determine that the EC is not in the disconnected state, and the electronic device performs steps S104 to S108.

[0072] In this embodiment, the BIOS ACPI module determines that the EC is not in the disconnected state, and only based on steps S104 to S106, the NTC temperature value is read from the EC side and written into the ADSP module, which can further ensure that the BIOS ACPI module can successfully read the NTC temperature value of the EC through the I2C, and the reading of the NTC temperature value will not fail due to the electronic device entering the S5 state, which can cause the OS system to appear IRP timeout and the electronic device to enter the 900E state.

[0073] S104, the BIOS ACPI module reads the NTC temperature value from the EC.

[0074] The EC can continuously record the NTC temperature value according to the collection order of the NTC temperature value. The BIOS ACPI module reads the NTC temperature value from the EC in response to the result that the EC is not in the disconnected state. In some embodiments, the BIOS ACPI module reads the NTC temperature value once every 5S based on the instruction of the driver module calling the BIOS ACPI module once every 5S. Of course, as described above, the electronic device is provided with three thermistors, and the BIOS ACPI module can read the NTC temperature value of the three thermistors at a time.

[0075] S105, the EC returns the NTC temperature value to the BIOS ACPI module.

[0076] In some embodiments, the BIOS ACPI module reads the NTC temperature value recorded by the EC through the GETW method, and the NTC temperature value is transmitted by the EC to the BIOS ACPI module through I2C.

[0077] S106, the BIOS ACPI module writes the NTC temperature value to the ADSP module.

[0078] The ADSP module can be understood as a small core of the SOC, which belongs to the kernel layer module. The BIOS ACPI module and the ADSP module communicate through Glink, so the BIOS ACPI module writes the NTC temperature value to the ADSP module through Glink.

[0079] S107, the BIOS ACPI module returns the indication information to the driver module to indicate that the reading and writing of the NTC temperature value is completed.

[0080] After the BIOS ACPI module writes the NTC temperature value to the ADSP module, the BIOS ACPI module can return the indication information to the driver module to indicate to the driver module that the BIOS ACPI module completes the reading and writing of the NTC temperature value this time.

[0081] S108, the ADSP module sets the charging current based on the NTC temperature value.

[0082] The ADSP module sets the charging current according to the NTC temperature value written by the BIOS ACPI module, and the process is described in the related art, which is not expanded here.

[0083] In the second stage, the electronic device enters S5 state from S0 state when the driving module receives the indication information returned by the BIOS ACPI module to determine that the reading and writing of the NTC temperature value is completed once, but the reading and writing of the NTC temperature value in the next time is not started.

[0084] In S109, the driving module determines that the electronic device is not in S0 state, and sets the flag flag as False.

[0085] In one application scenario, the electronic device is powered off after being charged, which may cause the driving module to detect that the electronic device is in the charging state and the electronic device enters S5 state. Thus, the driving module determines that the electronic device is not in S0 state, and sets the flag flag as False.

[0086] In another application scenario, the electronic device is in the charging state, and the driving module, the BIOS ACPI module, the ADSP module and the EC complete the reading and writing of the NTC temperature value based on the foregoing steps S101 to S107, and then the electronic device is powered off. When the electronic device is powered off, the electronic device is not in S0 state, and the driving module sets the flag flag as False.

[0087] The driving module sets the value of the flag flag in the manner as described in the foregoing step S101, which is not repeated here.

[0088] When the driving module sets the flag flag as False, the driving module does not perform step S102, that is, the driving module does not call the BIOS ACPI module to call the NTC temperature value once every 5S. Thus, the electronic device is prevented from entering S5 state when being powered off, the driving module is closed, the data transmission of I2C fails, the data read by ACPI has no return, and the OS system is triggered to have IRP timeout, and the electronic device enters 900E state.

[0089] In some embodiments, the driving module can determine that the electronic device is in S5 state based on the power action of the OS system. When the electronic device is powered off, the OS system can generate a power-down power action. Thus, the driving module can determine that the electronic device enters S5 state based on the power action.

[0090] In the third stage, the electronic device enters S5 state from S0 state after the driving module calls the BIOS ACPI module to call the NTC temperature value once every 5S.

[0091] In S110, the driving module determines that the electronic device is in AC state and S0 state, and sets the flag flag as True.

[0092] The specific implementation of this step is the same as that of the foregoing step S101. For details, refer to the contents of the foregoing step S101, which will not be repeated here.

[0093] S111, the driving module calls the BIOS ACPI module to call the NTC temperature value once every 5 seconds based on the flag flag being True.

[0094] The specific implementation of this step is the same as that of the foregoing step S102. For details, refer to the contents of the foregoing step S101, which will not be repeated here.

[0095] S112, the BIOS ACPI module determines whether the EC is in a disconnected state.

[0096] In one application scenario, the electronic device is in a charging state and in an S0 state, and the driving module sets the flag flag to True based on step S110. After the driving module calls the BIOS ACPI module to call the NTC temperature value once every 5 seconds, the electronic device is turned off to enter an S5 state, and the EC can be disconnected from the IC and be in a disconnected state. Based on this, the BIOS ACPI module determines that the EC is in a disconnected state.

[0097] If the BIOS ACPI module determines that the EC is in a disconnected state, step S113 is performed, and the contents of steps S104 to S106 are not performed. Therefore, this step belongs to the detection of the EC state before the BIOS ACPI module reads the NTC temperature value on the EC side, which can avoid the problem that the EC suddenly enters a disconnected state when the BIOS ACPI module reads the NTC temperature value on the EC side, resulting in that the BIOS ACPI module fails to read the NTC temperature value of the EC through I2C, causing the OS system to enter an S5 state and IRP to be timed out, and the electronic device to enter a 900E state.

[0098] S113, the BIOS ACPI module returns indication information to the driving module to indicate that the reading and writing of the NTC temperature value are completed.

[0099] The specific implementation of this step is the same as that of the foregoing step S107. For details, refer to the contents of the foregoing step S101, which will not be repeated here.

[0100] An electronic device is configured with a pressure-sensitive touchpad. The measurement data of the pressure-sensitive touchpad needs to be uploaded to an OS system so that the OS system can analyze the measurement data. The electronic device installs a housekeeping application. The pressure-sensitive touchpad includes a chip (a third processor), such as a microcontroller unit (MCU). The housekeeping application can periodically acquire the measurement data stored by the MCU. The housekeeping application and the MCU perform data transmission through a universal asynchronous receiver / transmitter (UART) (a second interface).

[0101] Figure 5 A timing sequence in which the housekeeping application acquires the measurement data of the pressure-sensitive touchpad is shown.

[0102] As shown in Figure 5 , the electronic device is in an S0 state. The housekeeping application can issue an OpenUart instruction to a basic input output system (BIOS) once every 4 hours. The BIOS opens a UART serial port and configures serial port parameters in response to the instruction. Then, the housekeeping application can issue a request for acquiring the MCU data of the pressure-sensitive touchpad. After receiving the request, the MCU transmits data to the UART serial port through direct memory access (DMA).

[0103] After the MCU finishes transmitting the data, the housekeeping application also issues a CloseUart instruction to close the UART serial port.

[0104] During the process in which the measurement data stored by the MCU is transmitted to the housekeeping application through the UART serial port, the electronic device enters an S3 state (also referred to as an MS state) from the S0 state. The BIOS calls a PS3 method to control the UART serial port to enter a D3 state (a low-power state), that is, to close the UART serial port. However, because the MCU is still continuously sending the measurement data to the UART serial port, the registers of the UART serial port are in a protection state. The close instruction of the UART serial port cannot be written into the registers of the UART serial port. The close response of the UART serial port is timed out. The OS system generates an IRP timeout, and then a display screen blue screen problem is caused. The blue screen code can be 0x133. The electronic device fails to enter the low-power state.

[0105] The S3 state belongs to Suspend to RAM. When the electronic device enters the S3 state, the states of the OS system, all application programs, and opened documents of the electronic device are saved in a memory. Except for the memory, other components stop being powered. The electronic device enters a low-power state. A user can quickly wake up the electronic device by clicking a keyboard, a mouse, or the like.

[0106] Based on this, another embodiment of the present application further provides a data reading and writing method for obtaining the maintenance data stored by the MCU. The data reading and writing method can also be applied to the electronic device proposed in the foregoing content, and the type, structure and software architecture of the electronic device are not described in detail here.

[0107] Figure 6 A timing diagram of the data reading and writing method provided by an embodiment of the present application is shown.

[0108] As shown in Figure 6 , the data reading and writing method comprises:

[0109] S201. The housekeeping application issues an OpenUart instruction to the BIOS every 4 hours.

[0110] The electronic device is in an S0 state, and the maintenance data stored by the MCU needs to be reported to the housekeeping application. Based on this, the housekeeping application issues an OpenUart instruction every 4 hours, and the instruction is used to open the UART serial port between the housekeeping application and the MCU. It can be understood that the frequency of issuing the OpenUart instruction by the housekeeping application every 4 hours is an example value, and does not constitute a limitation on the frequency of issuing the OpenUart instruction by the housekeeping application.

[0111] S202. The BIOS opens the UART serial port and configures serial port parameters in response to the OpenUart instruction.

[0112] The BIOS opens the UART serial port and configures serial port parameters in response to the OpenUart instruction, and the serial port parameters can include baud rate, data bits, parity bits and stop bits, etc. After the BIOS opens the UART serial port and configures the serial port parameters, the housekeeping application and the MCU can perform data transmission through the UART serial port.

[0113] S203. The housekeeping application sends a request for obtaining MCU data of the pressure-sensitive touch panel to the MCU.

[0114] The MCU data of the pressure-sensitive touch panel refers to the maintenance data of the pressure-sensitive touch panel stored by the MCU, including system logs and dotting data of the pressure-sensitive touch panel, etc.

[0115] S204. The MCU transmits first data to the UART serial port through DMA in response to the request.

[0116] The first data can be understood as all or part of the pressure sensing touchpad measurement data stored by the MCU, limited by the amount of data transmitted by the MCU to the UART serial port at a time. The MCU transmits the first data to the UART serial port through DMA, and the UART serial port transmits the first data to the housekeeping application for storage. Therefore, the MCU transmitting the first data to the UART serial port through DMA can also be understood as: the MCU transmits the first data to the housekeeping application through the UART serial port by using the DMA technology.

[0117] For example, the pressure sensing touchpad measurement data stored by the MCU includes the first data and the second data. The MCU transmits the first data to the UART serial port first, and then transmits the second data to the UART serial port after the transmission of the first data is completed.

[0118] In S205, the housekeeping application indicates to the BIOS that the OS system enters the S3 state from the S0 state.

[0119] During the process of transmitting the first data to the UART serial port by the MCU, the OS system enters the S3 state from the S0 state. After the OS system enters the S3 state, the screen of the electronic device will be off.

[0120] The OS system entering the S3 state from the S0 state can refer to: directly entering the S3 state from the S0 state, or entering the S3 state from the S0 state via the S1 state and the S2 state. The S1 state can refer to the most power-consuming sleep mode, in which all registers of the SOC are refreshed, the SOC stops executing instructions, and the SOC and the memory are powered; the S2 state can refer to a deeper sleep state than the S1 state, in which the SOC stops being powered.

[0121] In some embodiments, the housekeeping application sends an indication message to the BIOS, which can indicate that the OS system enters the S3 state from the S0 state. In one implementation, the OS system enters the S3 state, and the OS system calls the PTS method of the ACPI of the BIOS by issuing an instruction through the housekeeping application, and assigns a value to the flag, which can indicate whether the OS system is in the S3 state.

[0122] In S206, the MCU detects that the electronic device is in the off-screen state, and stops writing the first data to the UART.

[0123] As described in the foregoing step S205, after the OS system enters the S3 state, the screen of the electronic device will be off. The MCU can detect whether the electronic device is in the off-screen state to determine whether the OS system enters the S3 state.

[0124] In some embodiments, the MCU detects whether the electronic device is in the off-screen state in the following manner:

[0125] The OS system enters the S3 state, a PTS method of ACPI of the BIOS can be called by a housekeeping application issuing an instruction, and a flag is assigned a value, which can indicate whether the OS system is in the S3 state. The BIOS can write the value of the flag into the MCU. Whether the OS system is in the S3 state is determined based on the value of the flag, that is, whether the electronic device is in the screen-off state.

[0126] When the MCU detects that the electronic device is in the screen-off state, it can be determined that the OS system enters the S3 state. Based on this, the MCU stops writing the first data to the UART, and the register of the UART serial port can be released, so that the register of the UART serial port can be written with an instruction to close the UART serial port, to avoid a timeout of the UART serial port closing response, causing the OS system to generate an IRP timeout, and further causing the display screen to blue screen.

[0127] In S207, the housekeeping application issues a CloseUart instruction to the BIOS.

[0128] It can be understood that, when the housekeeping application detects that the OS system enters the S3 state, the housekeeping application issues a CloseUart instruction to the BIOS, and the CloseUart instruction is used to close the UART serial port.

[0129] In some embodiments, when the MCU detects that the electronic device is in the screen-off state, the MCU stops writing the first data to the UART. In this way, the housekeeping application cannot receive the complete first data, and the housekeeping application can delete the first data without storing it. Of course, in other embodiments, the housekeeping application can also save the first data.

[0130] In S208, the BIOS closes the UART serial port in response to the CloseUart instruction, and sets a closed serial port identifier.

[0131] In some embodiments, the BIOS responds to the CloseUart instruction by calling a PS3 method to control the UART serial port to enter the D3 state. The UART serial port enters the D3 state in the following manner: the UART serial port is closed.

[0132] After the BIOS closes the UART serial port, the BIOS can also set a closed serial port identifier for the UART serial port, and the closed serial port identifier indicates that the UART serial port is closed.

[0133] In S209, the housekeeping application indicates to the BIOS that the OS system enters the S0 state.

[0134] In some application scenarios, the OS system enters the S3 state, the user clicks the keyboard or the mouse, and the OS system can be re-awakened to enter the S0 state. The housekeeping application can detect that the OS system enters the S0 state through the API interface, and in some embodiments, the housekeeping application sends an indication message to the BIOS, which can indicate that the OS system enters the S0 state.

[0135] S210, the housekeeping application sends an OpenUart instruction to the BIOS every 4 hours.

[0136] The housekeeping application detects that the OS system enters the S0 state, and can send an OpenUart instruction to the BIOS. The specific implementation of this step can be referred to the content of the foregoing step S201, which will not be described here.

[0137] S211, the BIOS opens the UART serial port and configures the serial port parameters in response to the OpenUart instruction.

[0138] The specific implementation of step S211 can be referred to the content of the foregoing step S202, which will not be described here.

[0139] S212, the housekeeping application sends a request for obtaining MCU data of the pressure-sensitive touchpad to the MCU.

[0140] The specific implementation of step S212 can be referred to the content of the foregoing step S203, which will not be described here.

[0141] S213, the MCU transmits first data to the UART serial port through DMA in response to the request.

[0142] The specific implementation of step S213 can be referred to the content of the foregoing step S204, which will not be described here.

[0143] It should be noted that the operation of the MCU transmitting the first data to the UART serial port is interrupted due to the OS system entering the S3 state, and therefore, after the MCU receives the request for obtaining the MCU data of the pressure-sensitive touchpad, the MCU transmits the first data to the UART serial port through DMA in response to the request.

[0144] In some embodiments, step S212 can also not be performed, and after the BIOS opens the UART serial port and configures the serial port parameters in response to the OpenUart instruction, the MCU can actively transmit the first data to the UART serial port through DMA, and the first data transmitted by the UART serial port can be transmitted to the housekeeping application and stored by the housekeeping application.

[0145] Another embodiment of the present application also provides a computer readable storage medium, which stores instructions, when the instructions are run on a computer or a processor, cause the computer or the processor to perform one or more steps in any of the above methods.

[0146] The computer readable storage medium can be a non-transitory computer readable storage medium, for example, the non-transitory computer readable storage medium can be a Read-Only Memory (ROM), a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0147] Another embodiment of the present application also provides a computer program product containing instructions. When the computer program product is run on a computer or a processor, the computer or the processor performs one or more steps in any of the above methods.

Claims

1. A data read / write method, characterized in that, An embedded electronic device, the electronic device including a first processor and a second processor, the first processor and the second processor communicating data through a first interface; the method includes: The electronic device is in a charging state. The first processor obtains the temperature value stored by the second processor through the first interface, and adjusts the charging current of the electronic device based on the temperature value. The temperature value is used to indicate the temperature of the electronic device. During the charging process of the electronic device, when the first processor detects that the electronic device has been triggered to shut down, causing the acquisition of the temperature value stored by the second processor to fail, it executes the shutdown process of the electronic device based on the indication information. The indication information is used to indicate that the operation of the first processor to acquire the temperature value through the first interface has been completed.

2. The data read / write method according to claim 1, characterized in that, During the charging process of the electronic device, after the first processor detects that the electronic device has been triggered to shut down, the method further includes: The first processor sets the first flag to the second value.

3. The data read / write method according to claim 1, characterized in that, The first processor detects that the electronic device has been triggered to shut down, including: Based on the temperature value acquisition instruction, the first processor detects whether the connection between the second processor and the first interface has been disconnected; The first processor detects that the connection between the second processor and the first interface has been disconnected.

4. The data read / write method according to claim 3, characterized in that, Before the first processor detects whether the connection between the second processor and the first interface has been disconnected based on the temperature value acquisition instruction, the method further includes: The first processor determines the first flag as the first value.

5. The data read / write method according to claim 3, characterized in that, The step of detecting whether the connection between the second processor and the first interface is disconnected includes: The first processor detects whether the first parameter indicates that the connection between the second processor and the first interface has been disconnected.

6. The data read / write method according to any one of claims 1 to 5, characterized in that, The electronic device further includes a third processor, wherein the first processor and the third processor communicate data via a second interface, and the method further includes: When the third processor transmits first data to the first processor through the second interface, if the third processor detects that the electronic device has entered a low-power state, the third processor stops transmitting the first data to the first processor through the second interface.

7. The data read / write method according to claim 6, characterized in that, The first data refers to the maintenance data of the third processor.

8. The data read / write method according to claim 6, characterized in that, Also includes: In response to the electronic device entering a low-power state, the first processor shuts down the second interface.

9. The data read / write method according to claim 7, characterized in that, Also includes: In response to the electronic device entering a low-power state, the first processor shuts down the second interface.

10. The data read / write method according to claim 6, characterized in that, Also includes: In response to the electronic device transitioning from the low-power state to the normal state, the third processor transmits the first data to the first processor via the second interface.

11. The data read / write method according to claim 7, characterized in that, Also includes: In response to the electronic device transitioning from the low-power state to the normal state, the third processor transmits the first data to the first processor via the second interface.

12. The data read / write method according to claim 8, characterized in that, Also includes: In response to the electronic device transitioning from the low-power state to the normal state, the third processor transmits the first data to the first processor via the second interface.

13. The data read / write method according to claim 10, characterized in that, Before the third processor transmits the first data to the first processor through the second interface, it further includes: The first processor opens the second interface and configures the parameters of the second interface.

14. An electronic device, characterized in that, include: Multiple processors and memory; the multiple processors include a first processor, a second processor, and a third processor; The memory is coupled to the plurality of processors, and the memory is used to store computer program code, the computer program code including computer instructions. When the plurality of processors execute the computer instructions, the electronic device performs the data read / write method as described in any one of claims 1 to 13.

15. A computer-readable storage medium, characterized in that, Used to store computer programs, which, when executed, are specifically used to implement the data read / write method as described in any one of claims 1 to 13.

16. A computer program product, characterized in that, It stores instructions that, when the computer program product is run on the electronic device, cause the electronic device to implement the data read / write method as described in any one of claims 1 to 13.

Citation Information

Patent Citations

  • Shutdown method and device, equipment and computer readable storage medium

    CN108958811A

  • Electronic equipment shutdown control method and system

    CN112596444A

  • Data transmission method, data transmission device, electronic equipment and medium

    CN115665833A

  • Charging system, charging control program, and portable terminal

    US20090121685A1