EC serial port configuration method, device and storage medium
By multiplexing the GPIO pins of the EC serial port and setting its I/O space base address and interrupt number, the cumbersome EC serial port configuration is solved, and the communication between the EC serial port and the CPU is realized, and its usage rate is improved.
Patent Information
- Application Number
- CN202411842705.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-04
AI Technical Summary
EC serial ports are rarely used in existing computer systems, resulting in waste of resources. They are mainly due to their cumbersome configuration process, involving hardware configuration and software programming, and require specific knowledge and tools.
By multiplexing the GPIO pins of the EC serial port into the serial port pins, and setting the I/O space base address and interrupt number in the interrupt number register of the EC serial port in the configuration space of Super I/O, the EC serial port can receive data transmission information sent by external devices and generate interrupt signals, and send the interrupt signal and interrupt number to the CPU through the LPC.
It realizes communication between the EC serial port and the CPU, improves the usage rate of the EC serial port, simplifies its configuration process, and reduces dependence on specific knowledge and tools.
Smart Images

Figure CN119759815A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a configuration method, device and storage medium of an EC serial port. Background Art
[0002] EC serial port (Embedded Controller Serial Port) is an interface used to communicate with embedded controllers. An embedded controller is a dedicated hardware device, usually integrated with a computer motherboard, used to manage and control peripheral devices such as power management, fan control, keyboard input, touchpad, etc. The function of the EC serial port is to exchange data and transmit commands with the embedded controller through a serial communication protocol. It allows two-way communication between the computer system and the embedded controller to achieve control and management of peripheral devices. Through the EC serial port, the host system can send instructions to the embedded controller, such as adjusting the fan speed, setting the power mode, obtaining sensor data, etc. At the same time, the embedded controller can also transmit the status information of the peripheral device, sensor data, etc. to the host system for processing through the EC serial port.
[0003] In addition to being used to achieve communication between computer systems and embedded controllers, EC serial ports can also be used to achieve communication between computer systems and external devices such as other computers. However, if a computer system wants to communicate with external devices through an EC serial port, it must perform a series of settings according to the EC serial port data sheet. This setting process is not only cumbersome, but also involves hardware configuration and software programming, and may require specific knowledge and tools. This has led to EC serial ports being rarely used in existing computer systems, resulting in a waste of resources. Summary of the invention
[0004] In view of the above problems, the embodiments of the present application provide a configuration method, device and storage medium of an EC serial port, which improves the utilization rate of the EC serial port.
[0005] According to one aspect of an embodiment of the present application, a method for configuring an EC serial port is provided, the method comprising: the EC serial port is communicatively connected to a CPU of a computer motherboard and is used to connect an external device, the method comprising: multiplexing the GPIO pins of the EC serial port into serial port pins; setting the I / O space base address of the EC serial port and the interrupt number in the interrupt number register in the configuration space of the Super I / O, so that the EC serial port generates an interrupt signal when receiving data transmission information sent by the external device through the serial port pin, and sends the interrupt signal and the interrupt number to the CPU through the LPC; setting a read data byte value in the configuration register of the CPU, so that after receiving the interrupt signal and the interrupt number, the CPU reads the data of the EC serial port according to the I / O space base address and the read data byte value, wherein the data of the EC serial port is the data sent by the external device.
[0006] In an optional manner, the method further includes: reporting the I / O space base address and the interrupt number of the EC serial port to an operating system, so that the operating system obtains data received by the EC serial port according to the I / O space base address and the interrupt number.
[0007] In an optional manner, the multiplexing of the GPIO pins of the EC serial port into serial port pins further includes: determining a multiplexing number corresponding to each GPIO pin of the EC serial port; and modifying the bit segment value of the register corresponding to the GPIO pin to the multiplexing number corresponding to the GPIO pin.
[0008] In an optional manner, the method further includes: writing a first preset value into an interrupt processing register of the EC serial port, wherein the first preset value corresponds to a level value of the interrupt signal, so that the EC serial port generates an interrupt signal with a level value corresponding to the first preset value.
[0009] In an optional manner, after setting the I / O space base address of the EC serial port and the interrupt number in the interrupt number register in the configuration space of the super input / output controller, the method further includes: setting the interrupt trigger type in the interrupt request type register of the EC serial port so that the EC serial port generates the interrupt signal when the data transmission information meets the interrupt trigger type; setting the working clock of the EC serial port so that the EC serial port receives the data sent by the external device at the data transmission rate corresponding to the working clock.
[0010] In an optional manner, after multiplexing the GPIO pins of the EC serial port into serial port pins, the method further includes: entering the configuration space of the Super I / O in response to a received entry instruction; after setting the I / O space base address of the EC serial port and the interrupt number in the interrupt number register, the method further includes: exiting the configuration space of the Super I / O in response to a received exit instruction.
[0011] In an optional manner, the method further includes: setting a serial interrupt mode and a sampling start period in a configuration register of the CPU, so that after the CPU receives the interrupt signal according to the serial interrupt mode, it reads data from the EC serial port starting from the sampling start period.
[0012] In an optional manner, the method further includes: writing a second preset value into an interrupt mask register and a configuration start cycle register of the CPU, so that the CPU can receive all interrupt signals sent by the EC serial port.
[0013] According to another aspect of an embodiment of the present application, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the EC serial port configuration method provided in any of the above embodiments.
[0014] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for configuring the EC serial port provided in any of the above embodiments is implemented.
[0015] The embodiment of the present application multiplexes the GPIO pins of the EC serial port into serial port pins, and sets the I / O space base address of the EC serial port and the interrupt number in the interrupt number register, so that the EC serial port can receive data transmission information sent by an external device through the serial port pin, thereby generating an interrupt signal when the data transmission information is received, and sending the interrupt signal and the interrupt number to the CPU through the LPC. By setting the read data byte value of the configuration register in the CPU, the CPU can read the data sent by the external device in the EC serial port according to the I / O space base address and the read data byte value after receiving the terminal signal and the interrupt number. Through the setting of the EC serial port and the CPU, the EC serial port can receive data sent by an external device, and send an interrupt request to the CPU when receiving the data, and the CPU can process the interrupt request of the EC serial port and read the data sent by the external device in the EC serial port, so that the EC serial port realizes the communication between the external device and the CPU, that is, the computer system, and improves the utilization rate of the EC serial port.
[0016] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the embodiment of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the embodiment of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings are only used to illustrate the embodiments and are not to be considered as limiting the present application. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings. In the accompanying drawings:
[0018] Figure 1 A schematic diagram showing a flow chart of a method for configuring an EC serial port provided in an embodiment of the present application is shown;
[0019] Figure 2 A schematic diagram of the structure of the EC serial port configuration device provided in an embodiment of the present application is shown;
[0020] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0021] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein.
[0022] In the actual use of EC serial ports, in order to use EC serial ports to achieve two-way communication between computer systems and external devices, so as to achieve management and control of external devices, a series of settings must be performed according to the EC serial port data sheet. In this process, there are many steps to set up, but the data sheet often lacks specific setting details. Therefore, in the actual configuration and implementation of the EC serial port, it is necessary to continuously set up and test in combination with the EC serial port data sheet, which involves hardware configuration and software programming, and may require specific knowledge and tools, which leads to the EC serial port being rarely used in existing computer systems, resulting in a waste of resources.
[0023] For example, in a solution where a computer platform communicates with an external device via a serial port, commonly used serial port solutions either directly use a serial port integrated in a CPU (Central Processing Unit) or are implemented through a PCIE (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard) to serial port chip. In the case where the computer platform is equipped with an EC serial port and the EC serial port can provide functions similar to those of the above serial port, the underutilized EC serial port is undoubtedly a waste of system resources.
[0024] Based on this, the present application provides a configuration method of an EC serial port, by setting the GPIO (General Purpose Input / Output) pin of the EC serial port, the EC serial port can receive data sent by an external device, by setting the I / O space base address and interrupt number of the EC serial port, the EC serial port can send an interrupt signal and interrupt number to the CPU when receiving data, so that the CPU can process the interrupt request of the EC serial port according to the interrupt signal and interrupt number, and by setting the CPU's read data byte value, the CPU can read the data sent by the external device in the EC serial port. Through the above settings of the EC serial port and the CPU, the EC serial port realizes the communication between the CPU, that is, the computer system, and the external device, and improves the utilization rate of the EC serial port.
[0025] Figure 1 The flowchart of the EC serial port configuration method provided by the embodiment of the present application is shown, and the method is executed by an electronic device such as a computer, a server, etc. Figure 1 As shown, the method comprises the following steps:
[0026] Step 100: Multiplex the GPIO pins of the EC serial port into serial port pins.
[0027] GPIO pins are general purpose, they can be configured as input pins or output pins, but they do not have specific serial communication functions. Multiplexing GPIO pins into serial port pins enables the EC serial port to realize serial communication functions.
[0028] There are 9 GPIO pins of the EC serial port. After being multiplexed into serial port pins, these serial port pins are: carrier detection pin, receive data pin, send data pin, data terminal ready pin, signal ground pin, data device ready pin, request to send pin, clear to send pin, and ring indication pin.
[0029] Specifically, step 100 includes the following steps:
[0030] Step 110: Determine the multiplexing number corresponding to each GPIO pin of the EC serial port.
[0031] Step 120: Modify the bit field value of the register corresponding to the GPIO pin to the multiplexing number corresponding to the GPIO pin.
[0032] Each GPIO pin has one or more alternate functions, and each alternate function has a corresponding multiplexing number. For example, the multiplexing number of GPIO pin 2 is 2, and the alternate function is the RXD (receive data) function, and the multiplexing number of GPIO pin 3 is 3, and the alternate function is the TXD (transmit data) function.
[0033] In the AFR (Alternative Function Register) register of the GPIO pin, each GPIO pin is usually represented by a fixed bit segment, which may be a 4-bit field that can store a value representing the alternate function of the GPIO pin. Therefore, by modifying the bit segment value of the register corresponding to the GPIO pin to the multiplexing number corresponding to the GPIO pin, you can determine which alternate function the GPIO pin should perform based on this bit segment value. For example, after modifying the bit segment value of the register corresponding to GPIO pin 2 to 2, GPIO pin 2 is multiplexed into the RXD pin and has the RXD function.
[0034] When an external device is connected to the EC serial port and sends data transmission information to the serial port pin of the EC serial port, the serial port pin of the EC serial port receives the data transmission information, and, in response to the data transmission information, the EC serial port generates an interrupt signal and sends the interrupt signal to the CPU. The data transmission information may be a control instruction or communication data.
[0035] In the embodiment of the present application, the level value of the interrupt signal generated by the EC serial port is related to the first preset value written into the interrupt processing register, that is, the first preset value corresponds to the level value of the interrupt signal. Specifically, the interrupt processing register is the DIS_IRQ_LEVEL register of the EC serial port. When the first preset value written into the DIS_IRQ_LEVEL register is 0, the level value of the interrupt signal is a high level. When the first preset value written into the DIS_IRQ_LEVEL register is 1, the level value of the interrupt signal is a low level.
[0036] For example, when 0 is written to the interrupt processing register of the EC serial port, the EC serial port will query the value of the interrupt processing register after receiving the data transmission information. When the value of the interrupt processing register is 0, the EC serial port generates a high-level interrupt signal.
[0037] Step 200: In the configuration space of the Super I / O (Super Input / Output), set the I / O space base address of the EC serial port and the interrupt number in the interrupt number register, so that the EC serial port generates an interrupt signal when receiving data transmission information sent by an external device through the serial port pin, and sends the interrupt signal and interrupt number to the CPU through the LPC (Low Pin Count Bus).
[0038] The I / O space base address is information for storing the serial port I / O address, for example, 0x2F8, 0x3F8, etc. Through the I / O space base address, the CPU can access the register of the EC serial port and then read the data sent by the external device and stored in the EC serial port register.
[0039] The interrupt number in the interrupt number register corresponds to the EC serial port, for example, the interrupt number of EC serial port 1 is 1, and the interrupt number of EC serial port 2 is 2. The interrupt number is used to identify the interrupt signal of the EC serial port. The CPU can know the EC serial port that sends the interrupt number through the interrupt number, and then know the external device that needs to communicate with it through the EC serial port.
[0040] The EC serial port is connected to the CPU through LPC. The interrupt status register in the CPU has a bit corresponding to the interrupt number, and the value of this bit corresponds to the level value of the interrupt signal sent by the EC serial port. For example, assuming that the level value of the interrupt signal is 1, and the interrupt number of the EC serial port is 3, after the EC serial port sends the interrupt signal and interrupt number to the CPU, the value displayed in the interrupt status register bit 3 is 1. The CPU can determine the EC serial port that sent the interrupt signal by querying the bit value of the interrupt status register, and then the CPU will process the interrupt request of the EC serial port.
[0041] In some embodiments, in order to prevent the I / O space base address and interrupt number of the EC serial port from being tampered with at will and to avoid abnormal communication of the EC serial port, an entry instruction for entering the configuration space of the Super I / O can be set. The BIOS (Basic Input Output System) can enter the configuration space of the Super I / O through the entry instruction to modify the I / O space base address and interrupt number of the EC serial port. Similarly, an exit instruction for exiting the configuration space of the Super I / O is set, and the configuration space of the Super I / O is locked through the exit instruction to ensure that the I / O space base address and interrupt number of the EC serial port are not tampered with. Among them, the entry instruction and the exit instruction can both be a single instruction, or they can both be two or even more instructions in a certain order, and the entry instruction and the exit instruction are different.
[0042] Specifically, after setting the entry instruction and the exit instruction, when the user inputs the entry instruction, the electronic device responds to the entry instruction and enters the configuration space of the Super I / O; when the user inputs the exit instruction, the electronic device responds to the exit instruction, exits the configuration space of the Super I / O, and locks the configuration space of the Super I / O.
[0043] In some embodiments, step 200 further includes the following steps:
[0044] Step 201: setting the interrupt trigger type in the interrupt request type register of the EC serial port, so that the EC serial port generates an interrupt signal when data transmission information meets the interrupt trigger type.
[0045] The interrupt trigger type can be a level trigger type, such as high level trigger or high level trigger, or an edge trigger type, such as rising edge trigger or falling edge trigger.
[0046] Assuming that the interrupt trigger type is set to falling edge trigger, when the EC serial port receives data transmission information, the data transmission information jumps from high level to low level, and the falling edge trigger is satisfied, the EC serial port generates an interrupt signal. By setting the level trigger type, the continuity and conditions of the EC serial port generating interrupt signals can be controlled.
[0047] Step 202: Setting the working clock of the EC serial port so that the EC serial port receives data sent by the external device at a data transmission rate corresponding to the working clock.
[0048] The working clock can be 1.84MHz or 24Mhz. By setting the working clock of the EC serial port, the rate at which the EC serial port receives data from external devices can be controlled.
[0049] Step 300: Set the read data byte value in the CPU configuration register so that after receiving the interrupt signal and interrupt number, the CPU reads the data of the EC serial port according to the I / O space base address and the read data byte value, wherein the data of the EC serial port is the data sent by the external device.
[0050] After setting the EC serial port, the CPU can receive the interrupt request of the EC serial port. After that, the CPU needs to be set up so that the CPU can normally process the interrupt request of the EC serial port to read the data received by the EC serial port.
[0051] The read data byte value is the number of bytes of data that the CPU reads from the EC serial port each time according to the I / O space base address. It can be set to 1 byte or 4 bytes.
[0052] Assuming that the read data byte value is set to 1, after receiving the interrupt signal and interrupt number, the CPU can determine the EC serial port that generates the interrupt signal, and then the CPU executes the interrupt service routine of the EC serial port. In the interrupt service routine, the CPU accesses the register of the EC serial port according to the I / O space base address, and then reads the data sent by the external device in the register by reading 1 byte of data each time. In this way, the CPU can communicate with the external device through the EC serial port.
[0053] In some embodiments, the serial interrupt mode and the sampling start period in the configuration register of the CPU are set so that after the CPU receives an interrupt signal according to the serial interrupt mode, it starts reading the data of the EC serial port from the sampling start period.
[0054] The serial interrupt mode can be a continuous mode, a single-byte interrupt mode, or a buffer full interrupt mode, etc. In the embodiment of the present application, the serial interrupt mode is preferably a continuous mode, which can ensure that the CPU can continuously receive the interrupt signal sent by the EC serial port until the CPU reads all the data in the EC serial port register.
[0055] In serial communication, data is sampled within a specific clock cycle, and the sampling start cycle determines the starting point of data sampling. By setting the sampling start cycle, the time node for the CPU to read data can be limited to ensure that the CPU can normally read the data sent by the external device in the EC serial port register.
[0056] To ensure that the CPU can receive all interrupt signals sent by the EC serial port, in some embodiments, a second preset value is written to the interrupt mask register and the configuration start cycle register of the CPU to enable the CPU to receive all interrupt signals sent by the EC serial port.
[0057] The interrupt mask register is used to control which interrupt signals can be recognized by the CPU. The start cycle register is used to configure the timing parameters of the LPC interface to ensure the stability of interrupt signal transmission.
[0058] The second preset value may be 0. When 0 is written to the interrupt mask register and the configuration start cycle register, it indicates that all interrupt signals sent by the EC serial port are masked off, so that the CPU can receive all interrupt signals and process all interrupt requests of the EC serial port.
[0059] In some embodiments, after setting the EC serial port and the CPU according to steps 100 to 300, the I / O space base address and interrupt number of the EC serial port need to be reported to the operating system (OS) so that the OS can obtain the data received by the EC serial port according to the I / O space base address and interrupt number. Otherwise, the OS cannot obtain the interrupt signal of the EC serial port, causing abnormal communication function of the EC serial port.
[0060] Specifically, the name of the EC serial port is declared in the ACPI (Advanced Configuration and Power Management Interface) code, and then the I / O space base address and interrupt number used by the EC serial port are declared. When the OS starts, the OS will load the ACPI driver, and then the ACPI driver will parse the ACPI code to obtain the I / O space base address and interrupt number of the EC serial port. After that, the OS will allocate I / O ports and configure interrupt handlers for the EC serial port according to the I / O space base address and interrupt number, so that when an external device sends data to the EC serial port, the OS can receive the interrupt signal of the EC serial port and read the data received by the EC serial port in response to the interrupt signal, so that the user can manage the communication of the EC serial port through the OS, and then realize the application of EC serial port resources.
[0061] The embodiment of the present application multiplexes the GPIO pins of the EC serial port into serial port pins, and sets the I / O space base address of the EC serial port and the interrupt number in the interrupt number register, so that the EC serial port can receive data transmission information sent by an external device through the serial port pin, thereby generating an interrupt signal when the data transmission information is received, and sending the interrupt signal and the interrupt number to the CPU through the LPC. By setting the read data byte value of the configuration register in the CPU, the CPU can read the data sent by the external device in the EC serial port according to the I / O space base address and the read data byte value after receiving the terminal signal and the interrupt number. Through the setting of the EC serial port and the CPU, the EC serial port can receive data sent by an external device, and send an interrupt request to the CPU when receiving the data, and the CPU can process the interrupt request of the EC serial port and read the data sent by the external device in the EC serial port, so that the EC serial port realizes the communication between the external device and the CPU, that is, the computer system, and improves the utilization rate of the EC serial port.
[0062] Figure 2 FIG. 1 shows a schematic diagram of the structure of the EC serial port configuration device provided in an embodiment of the present application. Figure 2As shown, the device 400 includes: a pin multiplexing module 410, an EC serial port setting module 420 and a CPU setting module 430. The pin multiplexing module 410 is used to multiplex the GPIO pins of the EC serial port into serial port pins; the EC serial port setting module 420 is used to set the I / O space base address of the EC serial port and the interrupt number in the interrupt number register in the configuration space of the Super I / O, so that the EC serial port generates an interrupt signal when receiving data transmission information sent by an external device through the serial port pin, and sends the interrupt signal and the interrupt number to the CPU through the LPC; the CPU setting module 430 is used to set the read data byte value in the configuration register of the CPU, so that after receiving the interrupt signal and the interrupt number, the CPU reads the data of the EC serial port according to the I / O space base address and the read data byte value, wherein the data of the EC serial port is the data sent by the external device.
[0063] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown, and the specific embodiment of the present application does not limit the specific implementation of the electronic device.
[0064] like Figure 3 As shown, the electronic device may include: a processor (processor) 502 and a memory (memory) 504.
[0065] The memory 504 is used to store a computer program 506. The memory 504 may include a high-speed RAM memory, or may also include a non-volatile memory, such as at least one disk memory. The computer program 506 may include computer executable instructions.
[0066] The processor 502 is used to execute the computer program 506 to implement the above-mentioned EC serial port configuration method embodiment.
[0067] The processor 502 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the electronic device may be processors of the same type, such as one or more CPUs, or processors of different types, such as one or more CPUs and one or more ASICs.
[0068] An embodiment of the present application provides a computer-readable storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned EC serial port configuration method embodiment is implemented.
[0069] The embodiment of the present application provides a computer program, which can be executed by a processor to implement the above-mentioned EC serial port configuration method embodiment.
[0070] An embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the configuration method embodiment of the EC serial port is implemented.
[0071] In several embodiments provided in the present application, if any function is implemented in the form of a software function module / unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, part or all of the technical solution of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, server or other electronic device) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (RandomAccess Memory, RAM), disk or optical disk and other media that can store computer program code.
[0072] The algorithm or display provided here are not inherently related to any specific computer, virtual system or other equipment. Various general systems can also be used together with the teaching based on this. According to the above description, it is obvious to construct the structure required for this type of system. In addition, the present application embodiment is not directed to any specific programming language yet. It should be understood that various programming languages can be utilized to realize the content of the present application described here, and the above description of specific languages is to disclose the best mode of implementation of the present application.
[0073] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and that those skilled in the art may design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be constructed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of multiple such elements. The present application may be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In the claims that list several devices, several units or modules in these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.
[0074] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be construed as limiting the scope of the present application. It should be noted that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A method for configuring an EC serial port, characterized in that: The EC serial port is connected to the CPU of the computer mainboard for communication and is used to connect an external device. The method includes: Multiplexing the GPIO pins of the EC serial port into serial port pins; In the configuration space of the Super I / O, the I / O space base address of the EC serial port and the interrupt number in the interrupt number register are set, so that the EC serial port generates an interrupt signal when receiving data transmission information sent by the external device through the serial port pin, and sends the interrupt signal and the interrupt number to the CPU through the LPC; The read data byte value in the configuration register of the CPU is set so that after receiving the interrupt signal and the interrupt number, the CPU reads the data of the EC serial port according to the I / O space base address and the read data byte value, wherein the data of the EC serial port is the data sent by the external device.
2. The method according to claim 1, characterized in that The method further comprises: The I / O space base address and the interrupt number of the EC serial port are reported to an operating system, so that the operating system obtains data received by the EC serial port according to the I / O space base address and the interrupt number.
3. The method according to claim 1, characterized in that The method of multiplexing the GPIO pins of the EC serial port into serial port pins further includes: Determine the multiplexing number corresponding to each GPIO pin of the EC serial port; The bit segment value of the register corresponding to the GPIO pin is modified to the multiplexing number corresponding to the GPIO pin.
4. The method according to claim 1, characterized in that: The method further comprises: A first preset value is written into the interrupt processing register of the EC serial port, wherein the first preset value corresponds to the level value of the interrupt signal, so that the EC serial port generates an interrupt signal with a level value corresponding to the first preset value.
5. The method according to claim 1, characterized in that After setting the I / O space base address of the EC serial port and the interrupt number in the interrupt number register in the configuration space of the super input / output controller, the method further includes: Setting the interrupt trigger type in the interrupt request type register of the EC serial port, so that the EC serial port generates the interrupt signal when the data transmission information meets the interrupt trigger type; The working clock of the EC serial port is set so that the EC serial port receives the data sent by the external device at a data transmission rate corresponding to the working clock.
6. The method according to claim 1, characterized in that After the GPIO pins of the EC serial port are multiplexed into serial port pins, the method further includes: In response to the received entry instruction, enter the configuration space of the Super I / O; After setting the I / O space base address of the EC serial port and the interrupt number in the interrupt number register, the method further includes: In response to the received exit instruction, exit the configuration space of the Super I / O.
7. The method according to claim 1, characterized in that The method further comprises: The serial interrupt mode and the sampling start period in the configuration register of the CPU are set so that after the CPU receives the interrupt signal according to the serial interrupt mode, it starts to read the data of the EC serial port from the sampling start period.
8. The method according to claim 1, characterized in that: The method further comprises: A second preset value is written into the interrupt mask register and the configuration start cycle register of the CPU, so that the CPU can receive all interrupt signals sent by the EC serial port.
9. An electronic device comprising a memory, a processor and a computer program stored in the memory, characterized in that: The processor executes the computer program to implement the EC serial port configuration method according to any one of claims 1 to 8.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for configuring the EC serial port according to any one of claims 1 to 8 is implemented.