Method, device and storage medium for managing gpio resources
By creating GPIO directories and subdirectories in the Linux system, parsing device tree information, and utilizing interrupt callback mechanisms, the problem of poor cross-platform compatibility in GPIO resource management is solved, achieving rapid adaptation and reduced code redundancy.
Patent Information
- Application Number
- CN202511623059.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-07
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2045-11-07
AI Technical Summary
GPIO resource management is difficult to achieve cross-platform compatibility and rapid adaptation, which requires developers to manually rewrite code, increasing the workload of porting and extending the software and hardware integration cycle.
By creating GPIO directories and subdirectories in the Linux kernel system and application system, parsing the GPIO description information in the device tree source file, generating configuration GPIO interfaces, and using the registration interrupt callback mechanism and Netlink mechanism for GPIO resource management, a unified GPIO resource configuration and management is achieved.
It achieves cross-platform compatibility and rapid adaptation of GPIO resources, reduces code redundancy, simplifies the hardware platform replacement process, and improves development efficiency.
Smart Images

Figure CN121070843B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of embedded resource management, and more particularly to a method, device, and storage medium for managing GPIO resources. Background Technology
[0002] In the embedded systems field, general purpose input / output (GPIO) ports are the most frequently used peripheral resources for hardware and software interaction. Traditional solutions generally adopt a decentralized management model of "whoever uses it manages it": each device driver module directly calls the vendor library or register macros to independently complete operations such as clock enabling, multiplexing function configuration, direction setting, level reading and writing, and interrupt registration. GPIO drivers are usually implemented in a decentralized manner, with each device driver independently managing the GPIO pins it uses.
[0003] While this approach is simple to implement, it deeply binds pin configuration logic to specific register addresses, bit offsets, clock tree nodes, power domain numbers, and interrupt vector numbers, resulting in strong coupling between the entire codebase and the hardware platform. When product upgrades or cost optimizations require switching to a different manufacturer's SoC, developers must reread the new chip's datasheet, meticulously comparing clock enable bits, multiplexed function tables, electrical attribute fields, and numbering rules, manually rewriting all macro definitions and operation sequences. One-click migration through a unified abstraction layer or configuration files is not possible. Due to the lack of cross-platform compatibility, the same project often requires maintaining multiple differentiated code branches, increasing the workload of porting and significantly extending the hardware-software integration cycle, severely slowing down product iteration and failing to meet the rapid time-to-market requirements of IoT terminals. Therefore, to address the current technical challenges of cross-platform compatibility and rapid adaptation in GPIO resource management, a new technology is needed. Summary of the Invention
[0004] The main objective of this invention is to solve the technical problem that current GPIO resource management is difficult to achieve cross-platform compatibility and rapid adaptation.
[0005] The first aspect of this invention provides a method for managing GPIO resources. This method is applied to a GPIO resource management system, which includes a Linux application system and a Linux kernel system. The GPIO resource management method includes:
[0006] The Linux kernel system, based on the platform driver of the Linux application system, creates a GPIO directory file in the Linux application system.
[0007] Create a GPIO interface file in the GPIO directory file, wherein the GPIO interface file includes: a GPIO registration interface file;
[0008] Create a GPIOs subdirectory file in the Linux kernel system and place the GPIO interface file in the GPIOs subdirectory file;
[0009] Parse the GPIO description information in the preset device tree source file;
[0010] Based on the GPIO description information, a GPIO interface is generated and configured. Based on the GPIO interface, a GPIO resource request is sent to the Linux kernel.
[0011] Based on the GPIO resource request, resource parameters are obtained through the GPIOs subdirectory file and the GPIO registration interface file in the GPIO directory file;
[0012] Based on the preset registration interrupt callback mechanism and the resource parameters, a GPIO interface instance file is created in the Linux application system.
[0013] Optionally, in a first implementation of the first aspect of the present invention, the GPIO description information includes: control word data, and after the step of registering the interrupt callback mechanism using GPIO, creating a GPIO interface instance file in the Linux application system, and broadcasting the interrupt callback event to the Linux kernel system according to the Netlink mechanism, it further includes:
[0014] Based on the preset timer and the control word data, the corresponding interface of the GPIO interface instance file is periodically output with a level signal.
[0015] Optionally, in a second implementation of the first aspect of the present invention, obtaining resource parameters based on the GPIO resource request through the GPIOs subdirectory file and the GPIO registration interface file in the GPIO directory file includes:
[0016] The GPIO resource request is sent to the Linux application system through the GPIO registration interface file in the GPIOs subdirectory file;
[0017] The Linux application system receives the GPIO resource request and, based on the GPIO resource request, retrieves resource parameters from the application program in the Linux application system through the GPIO registration interface file in the GPIO directory file.
[0018] The resource parameters are sent to the Linux kernel system through the GPIO registration interface file in the GPIO directory file;
[0019] The Linux kernel system receives the resource parameters through the GPIO registration interface file in the GPIOs subdirectory.
[0020] Optionally, in a third implementation of the first aspect of the present invention, after the GPIO registration interrupt callback mechanism is used and the Linux application system creates a GPIO interface instance file, the following is further included:
[0021] According to the preset Netlink mechanism, a registration interruption callback event is broadcast to the Linux application system.
[0022] Optionally, in the fourth implementation of the first aspect of the present invention, the GPIO interface file further includes: a GPIO read interface file, and after broadcasting and sending the registration interrupt callback event to the Linux application system according to the preset Netlink mechanism, it further includes:
[0023] Receive an interface read command and obtain the GPIO interface instance information corresponding to the interface read command;
[0024] The GPIO interface instance information is sent to the Linux application system through the GPIOs subdirectory file and the GPIO read interface file in the GPIO directory file.
[0025] Optionally, in a fifth implementation of the first aspect of the present invention, the GPIO interface file further includes: a GPIO deregistration interface file, which, after broadcasting the registration interrupt callback event to the Linux application system according to a preset Netlink mechanism, further includes:
[0026] Receive an interface cancellation command, perform cancellation processing on the GPIO interface instance file corresponding to the interface cancellation command, and generate a cancellation result;
[0027] The deregistration result is sent to the Linux application system through the GPIOs subdirectory file and the GPIO deregistration interface file in the GPIO directory file.
[0028] Optionally, in a sixth implementation of the first aspect of the present invention, the parsing of the GPIO description information in the preset device tree source file includes:
[0029] The GPIOs node is obtained by querying the pre-configured device tree source file;
[0030] The information of the GPIOs nodes is extracted and processed to generate GPIO description information.
[0031] Optionally, in the seventh implementation of the first aspect of the present invention, generating the configuration GPIO interface based on the GPIO description information includes:
[0032] Based on the GPIO description information, the target GPIO interface is sequentially configured with pin configuration, direction configuration, electrical attribute configuration, interrupt callback configuration, and initial value configuration to generate a configured GPIO interface.
[0033] A second aspect of the present invention provides a GPIO resource management device, comprising: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a line; the at least one processor invokes the instructions in the memory to cause the GPIO resource management device to execute the GPIO resource management method described above.
[0034] A third aspect of the present invention provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the above-described GPIO resource management method.
[0035] In this embodiment of the invention, by creating a GPIO directory file and a GPIOs subdirectory file in the Linux kernel system and Linux application system, and setting the interface files in the GPIO directory file and GPIOs subdirectory file, configuration is performed through both device tree source files and file interfaces, adapting to the GPIO interface requirements at different stages of development and deployment. Based on a flexible level sequence control and interrupt event notification mechanism, the application scenarios of GPIO are expanded. Through the interface file control and management of the GPIO directory file and GPIOs subdirectory file, unified management and dynamic configuration of GPIO resources are achieved, significantly reducing code redundancy and solving the technical problem that current GPIO resource management struggles to achieve cross-platform compatibility and rapid adaptation. Attached Figure Description
[0036] Figure 1 This is a schematic diagram of one embodiment of the GPIO resource management method in this invention.
[0037] Figure 2 This is a schematic diagram of a specific embodiment of the 104 steps of the GPIO resource management method in this invention.
[0038] Figure 3 This is a schematic diagram of a specific embodiment of the 106 steps of the GPIO resource management method in this invention.
[0039] Figure 4 This is a schematic diagram of an embodiment of a GPIO resource management device according to an embodiment of the present invention. Detailed Implementation
[0040] This invention provides a method, device, and storage medium for managing GPIO resources.
[0041] The embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. While some embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the accompanying drawings and embodiments are for illustrative purposes only and are not intended to limit the scope of protection of the present invention.
[0042] In the description of the embodiments disclosed in this invention, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.
[0043] For ease of understanding, the specific process of the embodiments of the present invention is described below. Please refer to [link / reference]. Figure 1 This invention provides an embodiment of a GPIO resource management method. The GPIO resource management method is applied to a GPIO resource management system, which includes a Linux application system and a Linux kernel system. The GPIO resource management method includes:
[0044] 101. The Linux kernel system, based on the platform driver of the Linux application system, creates a GPIO directory file in the Linux application system;
[0045] In this embodiment, the Linux kernel system utilizes the platform driver of the Linux application system to create a GPIO directory file in the Linux application system. The GPIO directory file can actually be named gpio_manage1, and this directory is used to manage the driver-related files.
[0046] 102. Create a GPIO interface file in the GPIO directory file, wherein the GPIO interface file includes: a GPIO registration interface file;
[0047] In this embodiment, the Linux kernel system creates GPIO interface files in the GPIO directory file on the Linux application system. The GPIO interface files include interface driver files such as GPIO registration interface files, GPIO read interface files, and GPIO unregistration interface files.
[0048] 103. Create a GPIOs subdirectory file in the Linux kernel system and place the GPIO interface file in the GPIOs subdirectory file;
[0049] In this embodiment, a GPIOs subdirectory file is created in the Linux kernel system, and the GPIO interface files are placed in the GPIOs subdirectory file.
[0050] 104. Parse the GPIO description information in the preset device tree source file;
[0051] In this embodiment, the device tree source file is a text format used by the Linux kernel to describe hardware resources. Its function is to extract the hardware information on the board from the kernel code. The device tree source file contains the relationships between all device-related files, which the driver can request to use.
[0052] The GPIO description information is parsed from the device tree source file. This information includes: pin name, pin number, direction, initial value, control word, active low, function description, and interrupt enable. It's important to note that active low is used to unify the logic levels of external devices. When set to "active low," the application layer output logic "1" actually corresponds to a low level on the GPIO, thus ensuring compatibility with cathode-driven devices. GPIOs that support interrupt enable broadcast the event to the application layer via the Netlink mechanism when an interrupt occurs.
[0053] For details, please refer to Figure 2 , Figure 2 This is a specific embodiment of step 104 of the GPIO resource management method in this invention, which includes the following specific implementation methods:
[0054] 1041. Find the GPIOs node in the preset device tree source file;
[0055] 1042. Extract and process the information of the GPIOs nodes to generate GPIO description information.
[0056] In steps 1041-1042, the GPIOs node identifier is first obtained by querying the device tree source file. The pin name, pin number, direction, initial value, control word, active low, function description, interrupt enable, etc. are extracted from the GPIOs node identifier in sequence to generate GPIO description information.
[0057] 105. Based on the GPIO description information, generate a configured GPIO interface, and based on the configured GPIO interface, send a GPIO resource request to the Linux kernel;
[0058] In this embodiment, based on the GPIO description information, the parameters of the GPIO interfaces to be registered are first configured, and then the registration process is performed after the configuration is complete. During the registration process, a GPIO resource request is sent to the Linux kernel.
[0059] Specifically, step 105 includes the following specific implementation methods:
[0060] 1051. Based on the GPIO description information, the target GPIO interface is sequentially configured with pin configuration, direction configuration, electrical attribute configuration, interrupt callback configuration, and initial value configuration to generate a configured GPIO interface.
[0061] In step 1051, before accessing and registering the GPIO interface, the target GPIO interface needs to be configured in sequence, including pin configuration, direction configuration, electrical attribute configuration, interrupt callback configuration, and initial value configuration. After the configuration is completed, the configured GPIO interface is obtained.
[0062] 106. Based on the GPIO resource request, obtain the resource parameters through the GPIOs subdirectory file and the GPIO registration interface file in the GPIO directory file;
[0063] In this embodiment, the Linux kernel system obtains resource parameters from the application of the Linux application system based on the data exchange between the GPIOs subdirectory file and the GPIO registration interface file in the GPIO directory file for GPIO resource requests.
[0064] For details, please refer to Figure 3 , Figure 3 This is a specific embodiment of the 106 steps of the GPIO resource management method in this invention, which includes the following specific implementation methods:
[0065] 1061. Send the GPIO resource request to the Linux application system through the GPIO registration interface file in the GPIOs subdirectory file;
[0066] 1062. The Linux application system receives the GPIO resource request and, based on the GPIO resource request, retrieves resource parameters from the application program in the Linux application system through the GPIO registration interface file in the GPIO directory file;
[0067] 1063. Send the resource parameters to the Linux kernel system through the GPIO registration interface file in the GPIO directory file;
[0068] 1064. The Linux kernel system receives the resource parameters through the GPIO registration interface file in the GPIOs subdirectory file.
[0069] In steps 1061-1064, the Linux kernel system first sends the GPIO resource request to the Linux application system based on the GPIO registration interface file in the GPIOs subdirectory file. After receiving the GPIO resource request, the Linux application system uses the GPIO registration interface file in the GPIO directory file to retrieve the resource parameters from the application in the Linux application system, and then sends the resource parameters to the Linux kernel system through the GPIO registration interface file in the GPIO directory file.
[0070] In the Linux kernel system, the GPIO registration interface file in the GPIOs subdirectory receives resource parameters. These resource parameters are adapted to the platform driver of the Linux application system. The GPIO interface registered based on the resource parameters can be adapted to the corresponding platform for data interaction.
[0071] 107. Based on the preset registration interrupt callback mechanism and the resource parameters, create a GPIO interface instance file in the Linux application system.
[0072] In this embodiment, the registered interrupt callback mechanism is a set function that the kernel should call when an interrupt occurs on a certain GPIO pin (such as a level change). The kernel will automatically call the set function when the hardware interrupt arrives, and the driver does not need to poll.
[0073] By registering interrupt callback mechanisms and resource parameters, a GPIO interface instance file is created in the Linux application system. This GPIO interface instance file supports read, write, and control at the application layer. Simultaneously, an independent GPIO interface instance file is generated for each GPIO in the GPIOs subdirectory, supporting read, write, and control at the application layer.
[0074] Specifically, the GPIO description information includes: control word data. After step 107, the following specific implementation method is also included:
[0075] 108. Based on the preset timer and the control word data, periodically output level signals to the interface corresponding to the GPIO interface instance file.
[0076] In the 108 steps, the control word data is a binary sequence, with each bit representing the output level within a time unit. For example, the control word "11001000" will output high, high, low, low, high, low, low, low levels sequentially over 8 cycles, enabling complex waveform outputs such as buzzer driving and LED blinking.
[0077] By setting the period duration using a timer, high and low level signals are periodically output to the interface corresponding to the GPIO interface instance file, provided that the period duration is met.
[0078] Specifically, following step 107, the following specific implementation methods are also included:
[0079] 109. According to the preset Netlink mechanism, broadcast a registration interruption callback event to the Linux application system.
[0080] In this embodiment, the Netlink mechanism, a bidirectional, asynchronous, multicast socket communication mechanism provided by the Linux kernel between the kernel and the application layer, broadcasts the registration interrupt callback event to the application layer of the Linux application system after the registration interrupt callback event is triggered.
[0081] Furthermore, the GPIO interface file also includes a GPIO read interface file. Following step 109, the following specific implementation method is also included:
[0082] 1091. Receive the interface read instruction and obtain the GPIO interface instance information corresponding to the interface read instruction;
[0083] 1092. The GPIO interface instance information is sent to the Linux application system through the GPIOs subdirectory file and the GPIO read interface file in the GPIO directory file.
[0084] In steps 1091-1092, the Linux kernel system receives the interface read instruction, reads the GPIO interface instance information that needs to be read, and sends the GPIO interface instance information to the Linux application system based on the interaction between the GPIOs subdirectory file and the GPIO read interface file in the GPIO directory file so that the GPIO interface instance information can be displayed on the application.
[0085] Furthermore, the GPIO interface file also includes a GPIO unregistration interface file. Following step 109, the following specific implementation method is also included:
[0086] 1093. Receive the interface cancellation command, perform cancellation processing on the GPIO interface instance file corresponding to the interface cancellation command, and generate a cancellation result;
[0087] 1094. The cancellation result is sent to the Linux application system through the GPIOs subdirectory file and the GPIO cancellation interface file in the GPIO directory file.
[0088] In steps 1093-1094, an interface deregistration command is received. The corresponding GPIO interface instance file is deregistered in both the GPIOs subdirectory file and the GPIO directory file, generating a deregistration result. Then, based on the interaction between the GPIO deregistration interface files in the GPIOs subdirectory file and the GPIO directory file, the deregistration result is sent to the Linux application system so that the deregistration result can be displayed on the application.
[0089] In this embodiment of the invention, by creating GPIO directory files and GPIOs subdirectories in the Linux kernel system and Linux application system, and setting interface files in these files, configuration is performed using both device tree source files and file interfaces, adapting to the needs of different development and deployment stages. Based on a flexible level sequence control and interrupt event notification mechanism, the application scenarios of GPIO are expanded. Through the interface file control and management of the GPIO directory files and GPIOs subdirectories, unified management and dynamic configuration of GPIO resources are achieved, significantly reducing code redundancy and solving the current technical problem of GPIO resource management's difficulty in achieving cross-platform compatibility and rapid adaptation.
[0090] Figure 4 This is a schematic diagram of a GPIO resource management device 400 provided in an embodiment of the present invention. The GPIO resource management device 400 can vary significantly due to different configurations or performance characteristics. It may include one or more central processing units (CPUs) 410 (e.g., one or more processors) and a memory 420, and one or more storage media 430 (e.g., one or more mass storage devices) for storing application programs 433 or data 432. The memory 420 and storage media 430 can be temporary or persistent storage. The program stored in the storage media 430 may include one or more modules (not shown in the diagram), each module including a series of instruction operations on the GPIO resource management device 400. Furthermore, the processor 410 may be configured to communicate with the storage media 430 and execute the series of instruction operations in the storage media 430 on the GPIO resource management device 400.
[0091] The GPIO-based management device 400 may also include one or more power supplies 440, one or more wired or wireless network interfaces 450, one or more input / output interfaces 460, and / or one or more operating systems 431, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc. Those skilled in the art will understand that... Figure 4 The illustrated GPIO resource management device structure does not constitute a limitation on GPIO resource-based management devices, and may include more or fewer components than illustrated, or combine certain components, or have different component arrangements.
[0092] The present invention also provides a computer-readable storage medium, which can be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium, wherein the computer-readable storage medium stores instructions that, when executed on a computer, cause the computer to perform the steps of the GPIO resource management method.
[0093] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0094] Furthermore, although the operations are described in a specific order, this should be understood as requiring that such operations be performed in the specific order shown or in sequential order, or requiring that all illustrated operations be performed to achieve the desired result. In certain environments, multitasking and parallel processing may be advantageous. Similarly, although several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single implementation. Conversely, various features described in the context of a single implementation may also be implemented individually or in any suitable sub-combination in multiple implementations.
[0095] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A method for managing GPIO resources, characterized in that, The GPIO resource management method is applied to a GPIO resource management system, which includes a Linux application system and a Linux kernel system. The GPIO resource management method includes: The Linux kernel system, based on the platform driver of the Linux application system, creates a GPIO directory file in the Linux application system. Create a GPIO interface file in the GPIO directory file, wherein the GPIO interface file includes: a GPIO registration interface file; Create a GPIOs subdirectory file in the Linux kernel system and place the GPIO interface file in the GPIOs subdirectory file; Parse the GPIO description information in the preset device tree source file; Based on the GPIO description information, a GPIO interface is generated and configured. Based on the GPIO interface, a GPIO resource request is sent to the Linux kernel. Based on the GPIO resource request, resource parameters are obtained through the GPIOs subdirectory file and the GPIO registration interface file in the GPIO directory file; According to the preset registration interrupt callback mechanism and the resource parameters, a GPIO interface instance file is created in the Linux application system. The registration interrupt callback mechanism is that when an interrupt occurs on a certain GPIO pin, the Linux kernel automatically calls the set function when the hardware interrupt arrives and the driver does not poll.
2. The GPIO resource management method according to claim 1, characterized in that, The GPIO description information includes: control word data, and after the Linux application system creates a GPIO interface instance file according to the preset registration interrupt callback mechanism and the resource parameters, it also includes: Based on the preset timer and the control word data, the corresponding interface of the GPIO interface instance file is periodically output with a level signal.
3. The GPIO resource management method according to claim 1, characterized in that, The resource parameters obtained based on the GPIO resource request, through the GPIOs subdirectory file and the GPIO registration interface file in the GPIO directory file, include: The GPIO resource request is sent to the Linux application system through the GPIO registration interface file in the GPIOs subdirectory file; The Linux application system receives the GPIO resource request and, based on the GPIO resource request, retrieves resource parameters from the application program in the Linux application system through the GPIO registration interface file in the GPIO directory file. The resource parameters are sent to the Linux kernel system through the GPIO registration interface file in the GPIO directory file; The Linux kernel system receives the resource parameters through the GPIO registration interface file in the GPIOs subdirectory.
4. The GPIO resource management method according to claim 1, characterized in that, After the Linux application system creates a GPIO interface instance file according to the preset registration interrupt callback mechanism and the resource parameters, the following is also included: According to the preset Netlink mechanism, a registration interruption callback event is broadcast to the Linux application system.
5. The GPIO resource management method according to claim 4, characterized in that, The GPIO interface file also includes: a GPIO read interface file, which, after broadcasting the registration interrupt callback event to the Linux application system according to the preset Netlink mechanism, further includes: Receive an interface read command and obtain the GPIO interface instance information corresponding to the interface read command; The GPIO interface instance information is sent to the Linux application system through the GPIOs subdirectory file and the GPIO read interface file in the GPIO directory file.
6. The GPIO resource management method according to claim 4, characterized in that, The GPIO interface file also includes: a GPIO deregistration interface file, which, after broadcasting the registration interrupt callback event to the Linux application system according to the preset Netlink mechanism, further includes: Receive an interface cancellation command, perform cancellation processing on the GPIO interface instance file corresponding to the interface cancellation command, and generate a cancellation result; The deregistration result is sent to the Linux application system through the GPIOs subdirectory file and the GPIO deregistration interface file in the GPIO directory file.
7. The GPIO resource management method according to claim 1, characterized in that, The GPIO description information in the parsed preset device tree source file includes: The GPIOs node is obtained by querying the pre-configured device tree source file; The information of the GPIOs nodes is extracted and processed to generate GPIO description information.
8. The GPIO resource management method according to claim 1, characterized in that, The step of generating the configuration GPIO interface based on the GPIO description information includes: Based on the GPIO description information, the target GPIO interface is sequentially configured with pin configuration, direction configuration, electrical attribute configuration, interrupt callback configuration, and initial value configuration to generate a configured GPIO interface.
9. A GPIO resource management device, characterized in that, The GPIO resource management device includes: a memory and at least one processor, wherein the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor invokes the instructions in the memory to cause the GPIO resource management device to perform the GPIO resource management method as described in any one of claims 1-8.
10. A computer-readable storage medium storing a computer program thereon, characterized in that, When the computer program is executed by the processor, it implements the GPIO resource management method as described in any one of claims 1-8.
Citation Information
Patent Citations
System and method for improving GPIO (general purpose input and output) efficiency under linux
CN104516853A
Interrupt processing method, PCIe system and storage medium
CN120705094A