Data access method, device, electronic device and storage medium in protection mode
The serial port channel connection between the processor and the embedded controller solves the problem of inconvenient access to underlying data, realizes a simplified data access process, and reduces development difficulty and pressure.
Patent Information
- Application Number
- CN202510814596.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-18
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-06-18
AI Technical Summary
In a system with protected mode, existing technologies have problems when accessing underlying data: they are not simple and convenient enough, are difficult, and have high requirements for developers. Especially when the underlying data is invisible to the protection system, special drivers need to be installed or programs need to be written.
Through the serial port channel connection between the processor and the embedded controller, the communication connection instruction of the application is received, the system type is obtained and the communication connection is opened, so that the identity of the embedded controller is converted from unauthorized access to authorized access, data access instructions are received and the underlying data is obtained, and data transmission is carried out using the serial port channel.
It makes access to underlying data more convenient and simplified, reduces development difficulty, reduces the pressure on developers, and improves access efficiency.
Smart Images

Figure CN120316830B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer systems, and in particular to a data access method, device, electronic device and storage medium in a protected mode. Background Art
[0002] A protected-mode system is a computer system with protection mechanisms that effectively manage and protect system resources, preventing unauthorized access and manipulation, thereby improving system stability, security, and reliability. In a protected-mode system, the CPU and underlying embedded devices communicate via a "southbridge" and "northbridge" connection. In this case, the underlying embedded devices are invisible to the protection system and cannot be directly accessed.
[0003] When access to underlying data is required, if the underlying data is not visible to the protection system, special drivers need to be installed or programs need to be written to access the data. This conventional access to the underlying layer still has problems such as being not simple and convenient, being difficult, and having high requirements for developers. Summary of the Invention
[0004] The embodiments of the present application provide a data access method, device, electronic device and storage medium in a protection mode, which can improve the convenience of underlying data access and reduce the difficulty of data access.
[0005] In a first aspect, an embodiment of the present application provides a data access method in a protected mode, which is applied to a processor of an electronic device with a protected mode, wherein the processor is connected to an embedded controller via a serial port channel, and the protected mode is used to limit access and access permissions of the processor and the embedded controller. The method includes:
[0006] receiving a communication connection instruction from an application, obtaining a system type, and, based on the system type, initiating a communication connection via a serial port channel with the embedded controller, so that the identity of the embedded controller is converted from a first-type identity to a second-type identity, wherein the first-type identity is an identity without permission to access the underlying layer, and the second-type identity is an identity with permission to access the underlying layer;
[0007] receiving a first data access instruction from the application program, and sending a second data access instruction to the embedded controller based on the first data access instruction;
[0008] Obtain target data from the embedded controller and send the target data to the application, the target data being underlying data obtained and sent by the embedded controller, the underlying data including data stored by the embedded controller, the underlying data being data that cannot be directly obtained by the application when a serial port channel connection between the processor and the embedded controller is not established.
[0009] In a possible embodiment, the first interface of the processor is connected to the second interface of the embedded controller; and the opening of the communication connection with the serial port channel of the embedded controller based on the system type includes:
[0010] determining a communication protocol based on a device type of the embedded controller, wherein the communication protocol is a communication protocol between the processor and the embedded controller;
[0011] determining a connection scheme based on the communication protocol and the system type;
[0012] The embedded controller is connected based on the connection scheme, so that the embedded controller switches access rights in the protection mode, wherein the switching of access rights includes switching from an identity without permission to access the underlying layer to an identity with permission to access the underlying layer.
[0013] In a possible embodiment, the first data access instruction includes target task information for indicating a target location to be accessed and a type of target information to be obtained, and sending the second data access instruction to the embedded controller based on the first data access instruction includes:
[0014] Determining the target location to be visited and the type of target information to be acquired based on the target task information;
[0015] Determine a mapping task based on the target location to be visited and the type of target information to be obtained, wherein the mapping task is used to indicate a specific method for obtaining the target location to be visited and the type of target information to be obtained;
[0016] The second data access instruction is determined based on the mapping task, and the second data access instruction is sent to the embedded controller.
[0017] In a possible embodiment, the embedded controller is connected to a control device, the control device is used to control the embedded controller and / or the processor, the first data access instruction is associated with a target control value generated by the embedded controller or the processor after being controlled by the control device, and the method further includes:
[0018] receiving a control instruction from the control device, wherein the control instruction includes a performance adjustment instruction, and the performance adjustment instruction is used to instruct the processor to perform performance adjustment;
[0019] Responding to the control instruction, performing control based on the control instruction and generating the target control value;
[0020] The target regulation value is sent to the embedded controller so that the target data includes the target regulation value.
[0021] In a possible embodiment, after the step of opening a communication connection with the embedded controller through a serial port channel based on the system type, the method further includes:
[0022] A third data access instruction is received from the application program, and a fourth data access instruction is sent to the embedded controller based on the third data access instruction, where the fourth data access instruction is used to instruct the embedded controller to periodically obtain a change value.
[0023] In a possible embodiment, after the step of opening a communication connection with the embedded controller through a serial port channel based on the system type, the method further includes:
[0024] Receive a fifth data access instruction from the application, and send a sixth data access instruction to the embedded controller based on the fifth data access instruction, wherein the fifth data access instruction includes the target task information, which is used to indicate the target location to be written and the type of target information to be written, and the fifth data access instruction is used to indicate the target data to be written and the target location to be written.
[0025] In a second aspect, an embodiment of the present application provides a data access device in a protected mode, which is applied to a processor of a system having a protected mode, wherein the processor is connected to an embedded controller via a serial port channel, and wherein the protected mode is used to limit access and access permissions of the processor and the embedded controller, and the device comprises:
[0026] a communication connection module, configured to receive a communication connection instruction from an application, obtain a system type, and, based on the system type, initiate a communication connection via a serial port channel with the embedded controller, so that the identity of the embedded controller is converted from a first-type identity to a second-type identity, where the first-type identity is an identity without permission to access the underlying layer, and the second-type identity is an identity with permission to access the underlying layer;
[0027] an instruction transceiver module, configured to receive a first data access instruction from the application program, and send a second data access instruction to the embedded controller based on the first data access instruction;
[0028] A data transceiver module is used to obtain target data from the embedded controller and send the target data to the application. The target data is the underlying data obtained and sent by the embedded controller. The underlying data includes data stored by the embedded controller. The underlying data is data that cannot be directly obtained by the application when a serial port channel connection between the processor and the embedded controller is not established.
[0029] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor; when the processor executes the one or more programs, the processor executes instructions of some or all of the steps described in the first aspect of the embodiment of the present application.
[0030] In a possible embodiment, the electronic device also includes an embedded controller, and the processor is connected to the embedded controller; the embedded controller is used to receive data access instructions from the processor, and to obtain target data based on the data access instructions, and to send the target data to the processor; the processor and the embedded controller are connected via a wired connection or a wireless connection, the direct communication connection includes a serial communication connection, and the first interface of the processor is connected to the second interface of the embedded controller via a serial communication connection; the first interface includes a first sending pin and a first receiving pin, and the second interface includes a second sending pin and a second receiving pin; the serial channel connection includes a UART connection.
[0031] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium on which a computer program is stored, wherein the computer program includes a data access program in a protected mode, and the data access program in the protected mode includes an execution instruction. When the processor of the electronic device executes the execution instruction, the processor executes some or all of the steps described in the first aspect.
[0032] In a fifth aspect, embodiments of the present application provide a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to perform some or all of the steps described in the first aspect of the embodiments of the present application. The computer program product may be a software installation package.
[0033] By implementing an embodiment of the present application, a processor of an electronic device with a protected mode receives a communication connection instruction from an application, obtains a system type, and based on the system type, opens a communication connection between the serial port channel and the embedded controller, so that the identity of the embedded controller is converted from a first type of identity to a second type of identity, wherein the first type of identity is an identity without permission to access the underlying layer, and the second type of identity is an identity with permission to access the underlying layer; receives a first data access instruction from the application, and based on the first data access instruction, sends a second data access instruction to the embedded controller; obtains target data from the embedded controller and sends the target data to the application, wherein the target data is the underlying data obtained and sent by the embedded controller; the processor and the embedded controller are connected via a serial port channel. Compared with the current method of data access requiring a special driver or programming, a serial port channel is constructed between the processor and the embedded controller, and then the channel connection is opened during access, so that the embedded controller is visible to the access system, and then responds to the data access instruction to access the target data, making access to the underlying data simple and convenient, less difficult, and reducing the pressure on developers. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the background technology, the drawings required for use in the embodiments of the present invention or the background technology will be described below.
[0035] Figure 1a This is a system architecture diagram of the first system with protection mode provided in an embodiment of the present application;
[0036] Figure 1b This is a system architecture diagram of a second system with a protection mode provided in an embodiment of the present application;
[0037] Figure 1c This is a system architecture diagram of a third system with a protection mode provided in an embodiment of the present application;
[0038] Figure 1d This is a system architecture diagram of a fourth system with a protection mode provided in an embodiment of the present application;
[0039] Figure 1e This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0040] Figure 1f is a structural diagram of another electronic device provided in an embodiment of the present application;
[0041] Figure 2 This is a flowchart of a data access method in a protection mode provided by an embodiment of the present application;
[0042] Figure 3 This is a scenario diagram of a data access method in a protection mode provided by an embodiment of the present application;
[0043] Figure 4 This is a structural diagram of a data access device in a protection mode provided by an embodiment of the present application;
[0044] Figure 5 This is a structural diagram of another data access device in a protection mode proposed in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0046] The terms "first," "second," and the like in the specification and claims of this application and the accompanying drawings are used to distinguish between different objects, not to describe a specific order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or electronic device comprising a series of steps or units is not limited to the listed steps or units, but may, in an optional example, also include steps or units not listed, or may, in an optional example, include other steps or units inherent to the process, method, product, or electronic device.
[0047] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0048] A protected-mode system is a computer system with a protection mechanism that effectively manages and protects system resources, preventing unauthorized access and manipulation, thereby improving system stability, security, and reliability. In a protected-mode system, the CPU and underlying embedded devices communicate via a "southbridge" and "northbridge" connection. In this case, the underlying embedded devices are invisible to the protection system and cannot be directly accessed. When access to underlying data is required, if the underlying data is not visible to the protection system, special drivers must be installed or programming must be performed. However, this conventional approach to accessing the underlying data is still not simple and convenient, is difficult, and places high demands on developers.
[0049] To address the above-mentioned problems, an embodiment of the present application provides a processor of an electronic device with a protected mode, which receives a communication connection instruction from an application, obtains a system type, and, based on the system type, opens a communication connection between the processor and the embedded controller via a serial port channel, so that the identity of the embedded controller is converted from a first type of identity to a second type of identity, wherein the first type of identity is an identity without permission to access the underlying layer, and the second type of identity is an identity with permission to access the underlying layer; receives a first data access instruction from the application, and sends a second data access instruction to the embedded controller based on the first data access instruction; obtains target data from the embedded controller and sends the target data to the application, wherein the target data is the underlying data obtained and sent by the embedded controller; the processor and the embedded controller are connected via a serial port channel. Compared with the current method of data access requiring a special driver or programming, a serial port channel is constructed between the processor and the embedded controller, and then the channel connection is opened during access, so that the embedded controller is visible to the access system, and then responds to the data access instruction to access the target data, making access to the underlying data simple and convenient, less difficult, and reducing the pressure on developers.
[0050] It should be noted that protected mode is an operating mode of a computer processor (such as a CPU), primarily used in multitasking operating systems to provide security protection and resource management for programs and data. Protected mode introduces the concept of privilege levels, which are generally divided into four privilege levels: 0 to 3, with level 0 being the highest and level 3 being the lowest. Critical programs such as the operating system kernel run at privilege level 0, possessing the highest permissions and enabling access to and manipulation of all system resources. Applications, on the other hand, typically run at privilege level 3, limited to their own address space and access to limited system resources. This privilege level protection mechanism prevents applications from illegally accessing the system kernel and other critical resources, ensuring system security and stability. A system with protected mode is a computer operating system or other software system that leverages the protected mode features of a computer processor to implement system resource management, program isolation, and security protection. For example, Windows protected mode uses mechanisms such as privilege level protection to ensure that drivers can only access system resources and hardware devices within their permitted permissions. Processors such as the CPU, embedded controllers, and their internal registers may not be within these permissions.
[0051] The data access method, device, electronic device and storage medium provided in the protection mode of the present application can be applied to Figure 1a In systems with protected mode as shown, see Figure 1a , Figure 1a This is a system architecture diagram of the first system with protection mode provided by the embodiment of the present application, such as Figure 1aAs shown, the system 100 with protection mode includes: a processor 110 and an embedded controller 120. The processor 110 is a device or component used to control and regulate the operation of a system or device. It can receive input signals from the outside or inside, analyze, process, and judge these signals, and then generate corresponding control signals based on preset rules or algorithms to drive actuators or other components to enable the system or device to operate in a desired manner, achieve specific goals, or complete specific tasks. The processor 110 can be a CPU and can be used for command control, operation control, time control, data control, etc. The embedded controller 120 is a device in the system that directly interacts with the hardware and is responsible for performing the most basic and lowest-level operational tasks. It can be used to initialize, configure, monitor the hardware, and read and write low-level data. The above-mentioned hardware may include the processor 110, external devices, and registers within the embedded controller 120. The embedded controller 120 can be an embedded processor EC (embedded controller, EC), which can be used to access underlying data. Specifically, the underlying data can be power data, various chip data, sensor data, interface data, processor data, system status data, externally transmitted control data, etc. stored in the embedded controller 120. The externally transmitted control data can be data transmitted by an external device for controlling other devices.
[0052] Among them, the protected mode system can be a Windows system, Linux system, Ubuntu system, Unix system, embedded operating system, etc.
[0053] The processor 110 and the embedded controller 120 have at least one connection channel, which may specifically include a first connection channel. The first connection channel is a direct connection channel. Specifically, the processor 110 and the embedded controller 120 are directly connected via a serial port channel. Specifically, an interface of the processor 110 is connected to an interface of the embedded controller 120. The interface may be a pin. Specifically, the interface of the processor 110 may be at least one of a TX pin and an RX pin, and the interface of the embedded controller 120 may be at least one of a TX pin and an RX pin, with the TX pin used for data transmission and the RX pin used for data reception. In some cases, other pins or interfaces may be used, such as Type-C or USB, which are not limited here. The communication connection may be a universal asynchronous receiver transmitter (UART) connection, a serial peripheral interface (SPI), an inter-integrated circuit (I²C), or other methods, which are not limited here.
[0054] Among them, see Figure 1b , Figure 1b This is a system architecture diagram of a second system with a protection mode provided by an embodiment of the present application. A second connection channel is further provided between the processor 110 and the embedded controller 120. The second connection channel is a default communication connection channel. The default communication connection channel is an indirect connection channel, which may be a connection method using a platform processor hub (PCH), also known as a south bridge chip, as an intermediate device. The connection method between the processor 110 and the intermediate device may be a serial bus, specifically a high-speed serial computer expansion bus standard (Peripheral Component Interconnect Express, PCIe). The connection method between the intermediate device and the embedded controller may be through an enhanced serial peripheral interface (eSPI).
[0055] There is at least a first connection channel between the processor 110 and the embedded controller 120. When there is a second connection channel and a first connection channel, the second connection channel and the first connection channel can be switched according to a switching instruction. The switching instruction can be an external input instruction obtained by the processor.
[0056] The data access method, device, electronic device and storage medium provided in the protection mode of the embodiment of the present application can also be applied to Figure 1c In systems with protected mode as shown, see Figure 1c , Figure 1c This is a system architecture diagram of the third system with protection mode provided in the embodiment of the present application, such as Figure 1c As shown, the system 100 with protection mode includes: a processor 110 , an embedded controller 120 and a control device 130 .
[0057] The control device 130 may be a device for controlling any device or equipment included in the system 100 with a protection mode, for example, a device for adjusting the power or energy consumption of the processor 110. The control device 130 is externally connected to the embedded controller 120, which may be an embedded processor EC. The control device 130 may be used to control operating parameters such as the power consumption or energy consumption of the processor 110. After performing control, the control device 130 generates controlled data in the embedded controller 120, or may generate data changes, such as data changes at an IO port of a register in the EC. The EC may then obtain this data and send it to the processor 110.
[0058] The data access method, device, electronic device and storage medium provided in the protection mode of the embodiment of the present application can also be applied to Figure 1d In systems with protected mode as shown, see Figure 1d , Figure 1d This is a system architecture diagram of the fourth system with protection mode provided in the embodiment of the present application, such as Figure 1d As shown, the system 100 with protection mode includes: a processor 110 , an embedded controller 120 , a control device 130 and an application module 140 .
[0059] Among them, when the user needs to obtain or adjust the operating parameters of a hardware device through application control, the application module can generate corresponding control instructions according to the user's operation. Then, the instruction is sent to the corresponding processor 110 through the communication interface unit. After receiving the instruction, the processor 110 controls the hardware device to perform the corresponding operation according to the content of the instruction. The above-mentioned hardware device can be the processor 110, or it can be the control device 130, or it can be the register inside the embedded controller 120, etc. For example, if the instruction is to control the speed of the motor, the processor will adjust the drive signal of the motor according to the speed parameter in the instruction. The above-mentioned control instruction can also be implemented by the user controlling the control device 130. For the specific process, please refer to Figure 1cThe application module 140 is also used to display feedback information. The application module updates the user interface based on the received results, presenting the operation results to the user. The operation results can be target data obtained after the control device 130 or the application module 140 issues an instruction, specifically underlying data. The application module 140 and the processor 110 can be connected via a wired connection, a wireless connection, a software interface connection, a communication protocol connection, etc., the specific details of which are not limited here.
[0060] The application module may also be used to receive and transmit a communication connection instruction issued by a transmission user, and to switch the connection channel between the processor 110 and the embedded controller 120 , specifically, to switch between the first connection channel and the second connection channel.
[0061] It can be seen that in this embodiment, by implementing a system with a protection mode, a first connection channel is set to connect the processor and the embedded controller through a serial port, and in some cases there is a second connection channel. When a switching instruction is obtained, the second connection channel can be switched to the first connection channel, so that the embedded controller is visible in the access system, and then responds to the data access instruction to access the target data, making access to the underlying data simple and convenient, less difficult, and reducing the pressure on developers.
[0062] See also Figure 1e , Figure 1e 1 is a schematic diagram of the structure of an electronic device proposed in an embodiment of the present application. The electronic device 200 is equipped with a system with a protected mode. The electronic device 200 includes a processor 110, an embedded controller 120, a memory 150, and a communication interface 160. The memory 150 is used to store one or more programs 151 and is configured to be executed by the processor 110. The program includes instructions for executing any step of the following method embodiment;
[0063] Among them, the processor 110, the embedded controller 120, the memory 150, and the communication interface 160 are connected; the embedded controller 120 is used to receive data access instructions from the processor 110, and to obtain target data based on the data access instructions, and to send the target data to the processor.
[0064] See also Figure 1f , Figure 1f is a structural diagram of another electronic device proposed in an embodiment of the present application, such as Figure 1f As shown, the electronic device 200 includes a processor 110 , a memory 150 , a communication interface 160 and one or more programs 151 . The one or more programs 151 are stored in the memory 150 and are configured to be executed by the processor 110 .
[0065] The processor 110, memory 150, and communication interface 160 are interconnected and communicate with each other. Memory 150 can be a volatile memory such as a dynamic random access memory (DRAM) or a non-volatile memory such as a mechanical hard disk. Memory 150 is used to store a set of executable program codes, and the processor 110 is used to call one or more programs 151 stored in memory 150.
[0066] Among them, the electronic device 200 may include smart phones (such as Android phones, iOS phones, Windows Phone phones, etc.), tablet computers, PDAs, driving recorders, vehicle-mounted electronic devices, servers, laptops, mobile Internet electronic devices (MID, Mobile Internet Devices) or wearable electronic devices (such as smart watches, Bluetooth headsets), etc. The above are only examples and not exhaustive, including but not limited to the above electronic devices.
[0067] It can be seen that in this embodiment, through the above-mentioned electronic device, the embedded controller is visible to the access system, and then responds to the data access instruction to access the target data, making access to the underlying data simple and convenient, less difficult, and reducing the pressure on developers.
[0068] See also Figure 2 , Figure 2 This is a flow chart of a data access method in a protection mode provided by an embodiment of the present application. The method is applied to a processor of an electronic device with a protection mode, wherein the processor is connected to an embedded controller via a serial port channel. The protection mode is used to limit the access and access rights of the processor and the embedded controller, such as Figure 2 As shown, the method includes the following steps:
[0069] S210, receiving a communication connection instruction from an application, obtaining a system type, and opening a communication connection between the serial port channel and the embedded controller based on the system type, so that the identity of the embedded controller is converted from a first-type identity to a second-type identity, wherein the first-type identity is an identity without permission to access the underlying layer, and the second-type identity is an identity with permission to access the underlying layer.
[0070] Among them, the application can be corresponding to Figure 1d The application module in the embodiment receives the communication connection instruction, which is used to control the channel connection mode between the processor 110 and the embedded controller. The application switches the channel by obtaining the instruction selected or input by the user.
[0071] The system type is the type of the currently used system, such as Windows, Linux, or Ubuntu. Based on the currently used system, the serial port channel between the processor and the embedded controller is connected using the communication connection method specified for the current system type. The serial port connection methods between the processor and the embedded controller may be different or the same for different systems. Specifically, the serial port channel communication connection method corresponding to each system type may be pre-set and directly mappable.
[0072] After opening a communication connection with the embedded controller's serial port channel, i.e., opening the first connection channel, the embedded controller will experience a change in permissions due to the opening of the communication connection. The identity identifier is used to indicate whether the device can be directly accessed by the application program in the system in access mode. For example, some hardware, virtual devices, or software-simulated devices are not directly accessible in protected mode and are not visible to the protected mode, so the device manager will not directly display them. Because their functions are relatively low-level and mainly support the operation of other hardware devices, they generally do not require direct user management and operation. By opening the pre-established serial port communication, the embedded controller can be made visible to the protected mode, and the embedded controller can then be controlled to obtain low-level data.
[0073] Among them, if a communication disconnection instruction is received from the application and the communication connection with the embedded controller is disconnected, the embedded controller will generate a permission change due to the closure of the above communication connection, and the identity of the embedded controller will change from the second type of identity to the first type of identity.
[0074] Among them, if there are a first connection channel and a second connection channel between the processor and the embedded controller, after the serial port channel between the processor and the embedded controller, that is, the first connection channel, is opened, the current channel status can be that both the first connection channel and the second connection channel are connected, or the first connection channel is connected and the second connection channel is closed; after the serial port channel between the processor and the embedded controller, that is, the first connection channel, is closed, the current channel status can be that only the second connection channel is connected.
[0075] In a possible embodiment, the first interface of the processor is connected to the second interface of the embedded controller; the communication connection between the serial port channel and the embedded controller is opened based on the system type, including: determining a communication protocol based on the device type of the embedded controller, the communication protocol being the communication protocol between the processor and the embedded controller; determining a connection scheme based on the communication protocol and the system type; connecting the embedded controller based on the connection scheme, so that the access rights of the embedded controller are switched in the protection mode, and the switching of the access rights includes switching from an identity without permission to access the underlying layer to an identity with permission to access the underlying layer.
[0076] The processor may be a chip or a device. For example, when the processor is a chip, the first interface may be a specific pin for a serial port connection, such as at least one of an input pin and an output pin. The embedded controller may also be a chip or a device. For example, when the embedded controller is an embedded processor (EC), the second interface may be a serial communication interface. The first interface and the second interface are pre-connected to form a conductive connection channel.
[0077] Different embedded controllers may correspond to different communication protocols. The communication protocol is determined based on the device type of the embedded controller. The specific determination process may include first determining the device type of the embedded controller, then mapping and matching the device type with a preset communication protocol set to determine the communication protocol corresponding to the embedded controller. For example, if the embedded controller is an embedded device, the matching communication protocol may be SPI, I²C, or UART. Specifically, the UART protocol may be a serial communication protocol, and the specific protocol may include: VCC, UART_TXD, UART_RXD, GND. Based on the communication protocol and system type, a suitable connection tool or firewall rule is then determined. The connection tool may be a suitable driver, and the firewall rule may be one that ensures that the embedded controller is visible to the protection system without affecting the normal operation of the firewall. After the connection scheme is determined, a channel is established based on the established connection scheme, enabling data transmission between the embedded controller and the processor. After the connection channel between the embedded controller and the processor is established, the identity of the embedded controller changes from the current first-class identity to the second-class identity. The first-class identity is an identity without permission to access the underlying layer, while the second-class identity is an identity with permission to access the underlying layer.
[0078] It can be seen that in this embodiment, by building a serial communication connection between the processor and the embedded controller, the serial communication is turned on by opening the instruction, and then the identity of the embedded controller is changed, so that the embedded controller is changed from invisible to visible in the protection system. After it is visible, the embedded controller can be controlled and accessed, making access to the underlying data simple and convenient, less difficult, and reducing the pressure on developers.
[0079] S220: Receive a first data access instruction from the application program, and send a second data access instruction to the embedded controller based on the first data access instruction.
[0080] The application can issue a first data access instruction, which indicates a target location to be accessed and a target information type to be obtained. The first data access instruction may be in the form of text or a data structure such as JSON or XML, and may be a JSON string or a string in another format. The first data access instruction is then converted into a second data access instruction executable by the embedded controller, which indicates an access location and the type of information to be obtained by the embedded controller.
[0081] In a possible embodiment, the first data access instruction includes target task information for indicating the target location to be accessed and the type of target information to be obtained, and the sending of the second data access instruction to the embedded controller based on the first data access instruction includes: determining the target location to be accessed and the type of target information to be obtained based on the target task information; determining a mapping task based on the target location to be accessed and the type of target information to be obtained, the mapping task being used to indicate a specific method for obtaining the target location to be accessed and the type of target information to be obtained; determining the second data access instruction based on the mapping task, and sending the second data access instruction to the embedded controller.
[0082] The target task information is used to indicate the target location to be accessed and the type of target information to be obtained. It may exist in the form of text, data structure, such as JSON, XML, etc. For example, it may be a JSON string, or a string in other formats. It is then converted based on the target task information included in the first data access instruction. The type of information to be obtained may consist of a data type and an operation condition. For example, the data type may include the value of a register in the underlying EC or the device parameters of other external devices. The operation condition may be, for example, the corresponding operation condition for the data, whether it is reading, writing, or other operations. The target location to be accessed may be a specific port of a register in the EC or a specific module of an external device.
[0083] Wherein, determining the mapping task based on the target location to be accessed and the target information type to be obtained includes: determining the mapping task based on the target location to be accessed and the target information type to be obtained and a preset mapping task rule base, wherein the preset mapping rule base stores specific access methods corresponding to different combinations of target locations to be accessed and target information types to be obtained, and performing a query in the mapping rule base according to the determined target location to be accessed and target information type to be obtained. For example, when the target location to be accessed is "register_1, port_1" and the target information type to be obtained is "power", the baud rate is A, the data bits are X bits, and the stop bits are Y bits. According to the generated mapping task, the operation steps and parameters therein are converted into an instruction format that can be understood by the embedded controller. Then, a second data access instruction is sent through the serial port communication between the processor and the embedded controller.
[0084] As can be seen, in this embodiment, by efficiently determining the location and type of information to be accessed based on data access instructions and issuing hierarchical instructions, the system can flexibly respond to different types of embedded controllers and diverse task requirements. By making the embedded controller visible to the access system and then responding to data access instructions to access the target data, access to underlying data is simple, convenient, and less challenging, reducing the burden on developers.
[0085] In a possible embodiment, after the step of opening the communication connection between the serial port channel and the embedded controller based on the system type, the method further includes: receiving a third data access instruction from the application, and sending a fourth data access instruction to the embedded controller based on the third data access instruction, wherein the fourth data access instruction is used to instruct the embedded controller to periodically obtain a change value.
[0086] The third data access instruction includes target task information, indicating the target location to be accessed and the type of target information to be obtained. The third data access instruction is also used to instruct the processor to perform periodic continuous data access and automatically perform periodic continuous access before detecting an end instruction. The fourth data access instruction is used to instruct the embedded controller to perform periodic continuous data access.
[0087] Specifically, the processor determines the target location to be accessed and the target information type to be obtained based on the target task information included in the third data access instruction; determines a mapping task based on the target location to be accessed and the target information type to be obtained, and the mapping task is used to indicate a specific method for obtaining the target location to be accessed and the target information type to be obtained; determines the fourth data access instruction based on the mapping task, and sends the fourth data access instruction to the embedded controller.
[0088] For example, after receiving the fourth data access instruction, the embedded controller will operate according to the target location to be accessed and the type of target information to be obtained indicated by the fourth data access instruction. For the fourth data access instruction that periodically obtains the change value, the embedded controller will start the corresponding timer or counter and set the periodic time interval. For example, the embedded controller will perform a data acquisition operation according to the set time interval, such as every 1ms. The embedded controller obtains the corresponding change value at the target location to be accessed. After the embedded controller obtains the change value, it will transmit the data back. The above-mentioned change value is the data in the access location indicated by the fourth data access instruction. When a change occurs, it will be obtained and transmitted back. In some cases, it may not be a change value, but the current data may be continuously transmitted. After the data changes, an effect of obtaining a change value is produced.
[0089] For example, if the processor receives a power adjustment instruction to adjust the power level, the embedded controller receives the fourth data access instruction sent by the processor and parses it to the target location to be accessed. Specifically, in actual use, the target location is described by an address or a target location name, such as 0x10 or register_1; the type of data to be accessed is power level data. Then, after receiving the fourth data access instruction and before receiving the end instruction, the embedded controller continuously accesses the target location to be accessed with a preset access cycle to access the data type to be accessed, which is power level data. If the fourth data access instruction is of the read type, the target location to be accessed is continuously and periodically accessed to obtain the data type to be accessed, which is power level data, and data is transmitted back. The obtained power level data is transmitted back and the power level data is fed back to the application program so that the user can obtain the power level data.
[0090] As can be seen, in this embodiment, this method of enabling the embedded controller to periodically obtain change values based on application instructions helps ensure the timeliness and accuracy of data. During dynamic adjustments, data can be quickly updated, improving system resource utilization efficiency and enabling remote monitoring and automated control. This makes the embedded controller visible to the access system, making access to underlying data simple, convenient, and efficient.
[0091] In a possible embodiment, after the step of opening a communication connection between the processor and the embedded controller, the method further includes: receiving a fifth data access instruction from the application, and sending a sixth data access instruction to the embedded controller based on the fifth data access instruction, wherein the fifth data access instruction includes the target task information, which is used to indicate the target location to be written and the type of target information to be written, and the fifth data access instruction is used to indicate the target data to be written and the target location to be written.
[0092] Among them, the application generates a fifth data access instruction based on the user's operation, system logic or business needs. This instruction is the key information carrier for data writing interaction between the application and the embedded controller. It contains multiple important parts, among which the target task information clarifies the purpose and nature of the operation, that is, indicates the target location to be written and the type of target information to be written; it also clarifies the target data to be written and the target location to be written. After receiving the fifth data access instruction, the processor parses it in detail. It extracts key information such as the target location to be written, the type of target information to be written, and the target data to be written. By analyzing this information, the processor can clearly know which location of the embedded controller and what type of data needs to be written. According to the communication protocol and interface specification of the embedded controller, the processor converts the fifth data access instruction into a sixth data access instruction suitable for the embedded controller to understand and execute.
[0093] For example, if the processor needs to perform a power adjustment instruction to adjust the power gear, the embedded controller receives the fifth data access instruction sent by the processor and parses it to the target location to be accessed. Specifically, in actual use, the target location is described by an address or a target location name, such as 0x20 or register_2; the type of target information to be written is power gear data. Then, after receiving the sixth data access instruction, the embedded controller accesses the target location and accesses the target information type to be written, which is power gear data. If the fourth data access instruction is a read type, the target location to be accessed is continuously and periodically accessed, and the target information type to be written is power gear data. In some cases, the written power gear data can also be transmitted back, and the power gear data is fed back to the application so that the user can obtain the power gear data.
[0094] As can be seen, in this embodiment, the embedded controller can be controlled to write data, and the application generates a fifth data access instruction based on user operations, system logic, or business needs, allowing the system to flexibly adapt to different scenarios and needs, enhancing system flexibility. The clear instruction structure and processing flow make the data writing interaction between the application and the embedded controller more efficient. The processor can quickly parse and convert instructions, and the embedded controller can also receive and execute instructions in a timely manner, reducing data transmission and processing delays. The user can operate intuitively through the application, and the application generates corresponding instructions based on the user's operations to achieve control of the embedded controller, improving the user experience.
[0095] In one possible embodiment, the embedded controller is connected to a control device, the control device is used to control the embedded controller and / or the processor, and the first data access instruction is associated with a target control value generated by the embedded controller or the processor after being controlled by the control device. The method further includes: receiving a control instruction from the control device, the control instruction including a performance adjustment instruction, the performance adjustment instruction being used to instruct the processor to perform performance adjustment; responding to the control instruction, performing adjustment based on the control instruction and generating the target control value; and sending the target control value to the embedded controller, so that the target data includes the target control value.
[0096] The control device can be a device external to an embedded controller for adjusting device operating parameters. The control device can be connected to the processor via a pin on the processor or via an input / output interface on the processor. The control device can generate and send control instructions to the embedded controller, which then sends control instructions to control the processor or embedded controller. After receiving the control instructions, the processor or embedded controller adjusts operating parameters based on the control instructions. Specifically, the control instructions can be performance adjustment instructions for adjusting performance parameters, such as processor power consumption. After receiving the control instructions, the embedded controller parses and processes them and then performs the corresponding control operations according to the instructions. This may involve adjusting its own internal parameters. In response to the control instructions, the processor or embedded controller generates target control values after performing the control operations. After the processor or embedded controller completes performance control, its performance state changes, which may result in some adjusted values, namely target control values. These values can be new performance parameters, control signals, or other relevant data. The processor or embedded controller transmits these adjusted values to the embedded controller.
[0097] For details, please refer to Figure 3 , Figure 3This is a scenario diagram of a data access method in a protection mode provided by an embodiment of the present application. The control device can be a knob-type power consumption adjustment device, which is connected to the embedded controller through a pin or an interface, specifically, through a first connection channel. The embedded controller reads the input signal of the knob. The user manually rotates the mechanical knob according to actual needs. After rotation, the device corresponding to the embedded controller control instruction, that is, the processor, performs power consumption adjustment. For example, the current power consumption corresponding to the knob is 60, and the corresponding power consumption after the knob is adjusted is 130. After the processor adjusts the power consumption corresponding to the knob, the corresponding gear data, that is, 130, is generated in a register or at a port of the embedded controller. The embedded controller obtains the corresponding gear data and transmits the gear data back to the application. Specifically, it can be transmitted to the processor, and then transmitted to the application by the processor, or it can be directly transmitted to the application.
[0098] As can be seen, in this embodiment, the presence of the control device enables users or the system to flexibly control the embedded controller and processor according to different needs and scenarios. For users, the control device allows intuitive control and configuration of the system without having to deeply understand the complex underlying operations. Users can directly set up and adjust the system through the control device to meet specific needs.
[0099] S230 , acquiring target data from the embedded controller and sending the target data to the application program, where the target data is underlying data acquired and sent by the embedded controller.
[0100] The underlying data includes data stored in the embedded controller, and the underlying data is data that cannot be directly obtained by the application when the serial port channel connection between the processor and the embedded controller is not established.
[0101] The embedded controller transmits collected data to the connected processor via a specific communication interface and protocol. Specifically, data is transmitted via the serial port between the processor and the embedded controller. During data transmission, the embedded controller encapsulates and packages the collected data according to the communication protocol. For example, when using serial communication, data is encapsulated into a frame format containing a start bit, data bits, parity bit, and stop bits for transmission. These frames are then sent to the processor via the communication line. The processor sends the target data to the application via a connection channel connected to the application. This connection channel can be a network-based communication link (such as a local area network or the internet) or an inter-process communication mechanism (such as shared memory or a message queue), depending on the system architecture and design. After receiving the target data, the application processes and displays it according to its own functions and business logic.
[0102] In some cases, the embedded controller can send target data directly to the application through a connection channel connected to the application. This connection channel can be a network-based communication link (such as a local area network or the internet) or an inter-process communication mechanism (such as shared memory or a message queue), depending on the system architecture and design. After receiving the target data, the application will process and display it according to its own functions and business logic.
[0103] As can be seen, in this embodiment, the processor of the electronic device with protected mode receives a communication connection instruction from an application, obtains a system type, and based on the system type, opens a communication connection between the serial port channel and the embedded controller, so that the identity of the embedded controller is converted from a first type of identity to a second type of identity, where the first type of identity is an identity without permission to access the underlying layer, and the second type of identity is an identity with permission to access the underlying layer; receives a first data access instruction from the application, and based on the first data access instruction, sends a second data access instruction to the embedded controller; obtains target data from the embedded controller and sends the target data to the application, where the target data is the underlying data obtained and sent by the embedded controller; the processor and the embedded controller are connected via a serial port channel. Compared to the current method of data access that requires the use of special drivers or programming, a serial port channel is established between the processor and the embedded controller, and then the channel connection is opened during access, so that the embedded controller is visible to the access system, and then responds to the data access instruction to access the target data, making access to the underlying data simple and convenient, less difficult, and reducing the pressure on developers.
[0104] See Figure 4 , Figure 4 This is a schematic diagram of the structure of a data access device in protected mode, as proposed in an embodiment of the present application. The device is applied to a processor in a system with protected mode, the processor being connected to an embedded controller via a serial port. The protected mode is used to restrict access rights and permissions granted to the processor and embedded controller. The data access device in protected mode 400 includes a communication connection module 410, an instruction transceiver module 420, and a data transceiver module 430.
[0105] Among them, the communication connection module 410 is used to receive a communication connection instruction from the application, obtain the system type, and open a communication connection between the serial port channel and the embedded controller based on the system type, so that the identity of the embedded controller is converted from a first type of identity to a second type of identity, the first type of identity is an identity without permission to access the underlying layer, and the second type of identity is an identity with permission to access the underlying layer; the instruction transceiver module 420 is used to receive a first data access instruction from the application, and send a second data access instruction to the embedded controller based on the first data access instruction; the data transceiver module 430 is used to obtain target data from the embedded controller and send the target data to the application, and the target data is the underlying data obtained and sent by the embedded controller.
[0106] In a possible embodiment, the first interface of the processor is connected to the second interface of the embedded controller; and the communication connection module 410, in terms of opening the communication connection of the serial port channel with the embedded controller based on the system type, is specifically configured to:
[0107] determining a communication protocol based on a device type of the embedded controller, wherein the communication protocol is a communication protocol between the processor and the embedded controller;
[0108] determining a connection scheme based on the communication protocol and the system type;
[0109] The embedded controller is connected based on the connection scheme, so that the embedded controller switches access rights in the protection mode, wherein the switching of access rights includes switching from an identity without permission to access the underlying layer to an identity with permission to access the underlying layer.
[0110] In a possible embodiment, the first data access instruction includes target task information, which is used to indicate the target location to be accessed and the type of target information to be obtained. The instruction transceiver module 420 is specifically configured to send the second data access instruction to the embedded controller based on the first data access instruction:
[0111] Determining the target location to be visited and the type of target information to be acquired based on the target task information;
[0112] Determine a mapping task based on the target location to be visited and the type of target information to be obtained, wherein the mapping task is used to indicate a specific method for obtaining the target location to be visited and the type of target information to be obtained;
[0113] The second data access instruction is determined based on the mapping task, and the second data access instruction is sent to the embedded controller.
[0114] In a possible embodiment, the embedded controller is connected to a control device, the control device is used to control the embedded controller and / or the processor, the first data access instruction is associated with a target control value generated by the embedded controller or the processor after being controlled by the control device; and the instruction transceiver module 420 is further specifically used to:
[0115] receiving a control instruction from the control device, wherein the control instruction includes a performance adjustment instruction, and the performance adjustment instruction is used to instruct the processor to perform performance adjustment;
[0116] Responding to the control instruction, performing control based on the control instruction and generating the target control value;
[0117] The target regulation value is sent to the embedded controller so that the target data includes the target regulation value.
[0118] In a possible embodiment, the instruction transceiver module 420 is further specifically used to: receive a third data access instruction from the application, and send a fourth data access instruction to the embedded controller based on the third data access instruction, wherein the fourth data access instruction is used to instruct the embedded controller to periodically obtain a change value.
[0119] In a possible embodiment, the instruction transceiver module 420 is further specifically used to: receive a fifth data access instruction from the application, and send a sixth data access instruction to the embedded controller based on the fifth data access instruction, wherein the fifth data access instruction includes the target task information, which is used to indicate the target location to be written and the type of target information to be written, and the fifth data access instruction is used to indicate the target data to be written and the target location to be written.
[0120] It is worth noting that the specific functional implementation of the data access device in the protection mode can be found in the above Figure 2The description of the data access method in the protection mode shown is as follows, for example, the communication connection module 410 is used to implement the relevant content of executing S210, the instruction transceiver module 420 is used to implement the relevant content of executing S220, and the data transceiver module 430 is used to implement the relevant content of executing S230. The various units or modules in the data access device 400 in the protection mode can be individually or completely merged into one or several other units or modules to form a structure, or one (or some) of the units or modules can be further divided into multiple functionally smaller units or modules to form a structure, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present invention. The above-mentioned units or modules are divided based on logical functions. In actual applications, the functions of one unit (or module) are implemented by multiple units (or modules), or the functions of multiple units (or modules) are implemented by one unit (or module).
[0121] As can be seen, the data access device in the protected mode described in the embodiment of the present application receives a communication connection instruction from an application, obtains a system type, and based on the system type, opens a communication connection between the serial port channel and the embedded controller, so that the identity of the embedded controller is converted from a first type of identity to a second type of identity, where the first type of identity is an identity without permission to access the underlying layer, and the second type of identity is an identity with permission to access the underlying layer; receives a first data access instruction from the application, and based on the first data access instruction, sends a second data access instruction to the embedded controller; obtains target data from the embedded controller and sends the target data to the application, where the target data is the underlying data obtained and sent by the embedded controller; the processor and the embedded controller are connected via a serial port channel. Compared with the current method of data access that requires the use of special drivers or programming, a serial port channel is constructed between the processor and the embedded controller, and then the channel connection is opened during access, so that the embedded controller is visible to the access system, and then responds to the data access instruction to access the target data, making access to the underlying data simple and convenient, less difficult, and reducing the pressure on developers.
[0122] In the case of integrated units, see Figure 5 , Figure 5 is a structural diagram of another data access device under protection mode provided by an embodiment of the present application, such as Figure 5As shown, the data access device 400 in the protection mode includes: a processing module 402 and a communication module 401. The processing module 402 is used to control and manage the actions of the data access device 400 in the protection mode, for example, executing the steps of the communication connection module 410, the instruction transceiver module 420 and the data transceiver module 430, and / or other processes for executing the technology described herein. The communication module 401 is used for the interaction between the data access device 400 in the protection mode and other devices. Figure 5 As shown, the data access device 400 in the protection mode may further include a storage module 403, and the storage module 403 is used to store program codes and data of the data access device 400 in the protection mode.
[0123] The processing module 402 may be a processor, such as a central processing unit (CPU), 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, transistor logic devices, hardware components, or any combination thereof. It may implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like. The communication module 401 may be a transceiver, an RF circuit, or a communication interface, and the like. The storage module 403 may be a memory.
[0124] Among them, all relevant contents of each scenario involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and will not be repeated here. Figure 2 The data access method in protected mode is shown.
[0125] An embodiment of the present application also provides a computer storage medium, wherein the computer storage medium stores a computer program for data exchange, and the computer program enables a computer to execute part or all of the steps of any method described in the above method embodiments, and the above computer includes an electronic device.
[0126] The present application also provides a computer program product comprising a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to perform some or all of the steps of any of the methods described in the above method embodiments. The computer program product may be a software installation package, and the computer may comprise an electronic device.
[0127] It should be noted that for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0128] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0129] In the several embodiments provided in this application, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0130] The units described above as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0131] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0132] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory and includes a number of instructions for enabling a computer electronic device (which can be a personal computer, electronic device, or network electronic device, etc.) to execute all or part of the steps of the above-mentioned methods in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk, etc. Various media that can store program code.
[0133] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program. The program can be stored in a computer-readable memory, which may include a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0134] The above is a detailed introduction to the embodiments of the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A data access method in a protection mode, characterized in that: A processor of an electronic device having a protection mode, wherein the processor is connected to an embedded controller via a serial port channel, wherein the protection mode is used to limit access to and access permissions of the processor and the embedded controller, and wherein the method comprises: receiving a communication connection instruction from an application, obtaining a system type, and, based on the system type, initiating a communication connection via a serial port channel with the embedded controller, so that the identity of the embedded controller is converted from a first-type identity to a second-type identity, wherein the first-type identity is an identity without permission to access the underlying layer, and the second-type identity is an identity with permission to access the underlying layer; receiving a first data access instruction from the application program, and sending a second data access instruction to the embedded controller based on the first data access instruction; Obtain target data from the embedded controller and send the target data to the application, the target data being underlying data obtained and sent by the embedded controller, the underlying data including data stored by the embedded controller, the underlying data being data that cannot be directly obtained by the application when a serial port channel connection between the processor and the embedded controller is not established.
2. The method according to claim 1, characterized in that The first interface of the processor is connected to the second interface of the embedded controller; and the communication connection between the serial port channel and the embedded controller is opened based on the system type, including: determining a communication protocol based on a device type of the embedded controller, wherein the communication protocol is a communication protocol between the processor and the embedded controller; determining a connection scheme based on the communication protocol and the system type; The embedded controller is connected based on the connection scheme, so that the embedded controller switches access rights in the protection mode, wherein the switching of access rights includes switching from an identity without permission to access the underlying layer to an identity with permission to access the underlying layer.
3. The method according to claim 1 or 2, characterized in that The first data access instruction includes target task information for indicating a target location to be accessed and a type of target information to be obtained, and sending a second data access instruction to the embedded controller based on the first data access instruction includes: Determining the target location to be visited and the type of target information to be acquired based on the target task information; Determine a mapping task based on the target location to be visited and the type of target information to be obtained, wherein the mapping task is used to indicate a specific method for obtaining the target location to be visited and the type of target information to be obtained; The second data access instruction is determined based on the mapping task, and the second data access instruction is sent to the embedded controller.
4. The method according to claim 3, characterized in that The embedded controller is connected to a control device, the control device is used to control the embedded controller and / or the processor, the first data access instruction is associated with a target control value generated by the embedded controller or the processor after being controlled by the control device, and the method further includes: receiving a control instruction from the control device, wherein the control instruction includes a performance adjustment instruction, and the performance adjustment instruction is used to instruct the processor to perform performance adjustment; Responding to the control instruction, performing control based on the control instruction and generating the target control value; The target regulation value is sent to the embedded controller so that the target data includes the target regulation value.
5. The method according to claim 4, characterized in that After the step of opening a communication connection between the serial port channel and the embedded controller based on the system type, the method further includes: A third data access instruction is received from the application program, and a fourth data access instruction is sent to the embedded controller based on the third data access instruction, where the fourth data access instruction is used to instruct the embedded controller to periodically obtain a change value.
6. The method according to claim 3, characterized in that After the step of opening a communication connection between the serial port channel and the embedded controller based on the system type, the method further includes: Receive a fifth data access instruction from the application, and send a sixth data access instruction to the embedded controller based on the fifth data access instruction, wherein the fifth data access instruction includes the target task information, which is used to indicate the target location to be written and the type of target information to be written, and the fifth data access instruction is used to indicate the target data to be written and the target location to be written.
7. A data access device in a protection mode, characterized in that: A processor for a system with a protection mode, wherein the processor is connected to an embedded controller via a serial port channel, wherein the protection mode is used to limit access to and access permissions of the processor and the embedded controller, and wherein the device comprises: a communication connection module, configured to receive a communication connection instruction from an application, obtain a system type, and, based on the system type, initiate a communication connection via a serial port channel with the embedded controller, so that the identity of the embedded controller is converted from a first-type identity to a second-type identity, where the first-type identity is an identity without permission to access the underlying layer, and the second-type identity is an identity with permission to access the underlying layer; an instruction transceiver module, configured to receive a first data access instruction from the application program, and send a second data access instruction to the embedded controller based on the first data access instruction; A data transceiver module is used to obtain target data from the embedded controller and send the target data to the application. The target data is the underlying data obtained and sent by the embedded controller. The underlying data includes data stored by the embedded controller. The underlying data is data that cannot be directly obtained by the application when a serial port channel connection between the processor and the embedded controller is not established.
8. An electronic device, characterized in that: Equipped with a system having a protection mode, the electronic device includes a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor; When the processor executes the one or more programs, the processor performs the method according to any one of claims 1 to 6.
9. The electronic device according to claim 8, wherein: The electronic device further includes an embedded controller, the processor being connected to the embedded controller; the embedded controller being configured to receive a data access instruction from the processor, and to obtain target data based on the data access instruction, and to send the target data to the processor; The processor and the embedded controller are connected via a wired or wireless connection, the direct communication connection includes a serial communication connection, the first interface of the processor and the second interface of the embedded controller are connected via a serial communication connection; the first interface includes a first sending pin and a first receiving pin, and the second interface includes a second sending pin and a second receiving pin; the serial channel connection includes a UART connection.
10. A computer-readable storage medium, characterized in that A computer program is stored, the computer program including a data access program in a protected mode, the data access program in the protected mode including an execution instruction, and when a processor of an electronic device executes the execution instruction, the processor executes the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Data read-write method and equipment for charging chip
CN116540933A
Data access method, heterogeneous system, electronic device, medium and program product
CN119127094A