Demultiplexing method and apparatus, GPIO module, electronic device, and storage medium

By automatically obtaining register addresses and configuration values ​​through a preset demultiplexing array, the problem of cumbersome and error-prone chip pin demultiplexing process is solved, achieving efficient and accurate demultiplexing operation, which is applicable to various chip types.

CN116244241BActive Publication Date: 2026-06-26HANGZHOU JIEFENG TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HANGZHOU JIEFENG TECH CO LTD
Filing Date
2023-03-01
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

The demultiplexing process of chip pins in existing technologies is cumbersome and prone to errors, resulting in low efficiency and accuracy.

Method used

By using a preset demultiplexing array, the register address and demultiplexing register configuration value can be directly obtained using the function name, thereby realizing automatic demultiplexing of chip pins. It supports batch demultiplexing of function names with wildcards and connectors.

Benefits of technology

It improves the efficiency and accuracy of chip pin demultiplexing, simplifies user operation, reduces the time spent manually searching for information, and is applicable to different types of chips.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116244241B_ABST
    Figure CN116244241B_ABST
Patent Text Reader

Abstract

The application provides a demultiplexing method, device, GPIO module, electronic equipment and storage medium. The demultiplexing method comprises: receiving a function name of a function to be demultiplexed; demultiplexing the function corresponding to the function name based on a preset demultiplexing array, the preset demultiplexing array comprising a function name, a register address and a demultiplexing register configuration value and a corresponding relationship among the three, the demultiplexing being used to configure the register address corresponding to a pin based on the demultiplexing register configuration value corresponding to the function name, so that the pin realizes the function corresponding to the function name. Through the above demultiplexing method, the demultiplexing of the chip pin function can be realized only by receiving the function name, so that the demultiplexing related operation becomes quite simple, and the efficiency and accuracy of the demultiplexing are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more specifically, to a demultiplexing method, apparatus, GPIO module, electronic device, and storage medium. Background Technology

[0002] In chips, multiple functions are often multiplexed onto a single pin, allowing one pin to perform multiple functions.

[0003] Each pin has a corresponding demultiplexing register. By modifying the configuration information of the demultiplexing register to different values, the pins can perform different functions. The above-mentioned configuration process of the demultiplexing register is also called demultiplexing.

[0004] Currently, when a certain function of a chip pin needs to be used, it is usually necessary to manually consult the datasheet to obtain the demultiplexing register and address corresponding to the function to be used, the configuration information required for demultiplexing, and write the configuration value of the demultiplexing register to the address of the demultiplexing register to achieve demultiplexing.

[0005] The above-mentioned method of demultiplexing by manually consulting data manuals is cumbersome and prone to errors, resulting in low efficiency and accuracy of demultiplexing. Summary of the Invention

[0006] In view of this, this application aims to provide a demultiplexing method, apparatus, GPIO (General-purpose input / output) module, electronic device, and storage medium to improve the demultiplexing efficiency and accuracy of chips.

[0007] In a first aspect, embodiments of this application provide a demultiplexing method, comprising: receiving a function name of a function to be demultiplexed; demultiplexing the function corresponding to the function name based on a preset demultiplexing array, wherein the preset demultiplexing array includes a function name, a register address, a demultiplexing register configuration value, and the correspondence between the three, wherein the demultiplexing is used to configure the register address corresponding to the pin based on the demultiplexing register configuration value corresponding to the function name, so that the pin implements the function corresponding to the function name.

[0008] In this embodiment, the preset demultiplexing array includes the function name, register address, demultiplexing register configuration value, and the correspondence between them. When demultiplexing is required, only the function name of the function to be demultiplexed needs to be received from the user, and the function can be demultiplexed through the preset demultiplexing array. Compared to the prior art of consulting relevant materials to determine the corresponding pin, register address, and demultiplexing register configuration value of the function name, this application allows the user to achieve demultiplexing simply by inputting the function name of the function to be demultiplexed. This reduces the time users spend searching for demultiplexing-related information and improves demultiplexing efficiency.

[0009] In one embodiment, demultiplexing the function corresponding to the function name based on a preset demultiplexing array includes: determining the register address and demultiplexing register configuration value corresponding to the function name from the preset demultiplexing array; the preset demultiplexing array includes a first array, the first array including multiple register addresses, the function name of the function multiplexed by each register address, and the demultiplexing register configuration value corresponding to each function name, wherein each register address corresponds to a pin; configuring the register address based on the demultiplexing register configuration value.

[0010] Different information can be set in the preset demultiplexing array. In this embodiment, a first array is set in the preset demultiplexing array. The first array includes multiple register addresses, the function name of the function multiplexed by each register address, and the demultiplexing register configuration value corresponding to each function name. Thus, after receiving the function name, the register address and demultiplexing register configuration value corresponding to the function name can be determined relatively quickly according to the first array. Then, the register address is configured using the demultiplexing register configuration value to realize the demultiplexing of the function. Compared with manually consulting information, it can effectively improve the efficiency and accuracy of demultiplexing.

[0011] In one embodiment, the preset demultiplexing array further includes a second array, which includes multiple register addresses corresponding to each function name and an enabled register address corresponding to each function name. Determining the register address and demultiplexing register configuration value corresponding to the function name from the preset demultiplexing array includes: if the function name is configurable among multiple register addresses, then determining the unique register address corresponding to the function name based on the second array; and determining the demultiplexing register configuration value corresponding to the function name based on the uniquely corresponding register address and the first array.

[0012] To address the issue that many chips can demultiplex a function through different register addresses, this embodiment includes a second array within a preset demultiplexing array. This second array contains the function names and their corresponding enabled register addresses. During demultiplexing, the second array can be used to uniquely identify the register address corresponding to the function name, thus enabling demultiplexing of that function name and preventing demultiplexing errors caused by a function being configured to a register that does not correspond to the actual pin.

[0013] In one embodiment, the preset demultiplexing array further includes the bit offset and the number of bits occupied by the demultiplexing register configuration value in the demultiplexing register address; after receiving the function name of the function to be demultiplexed, the method further includes: determining the bit offset and the number of bits occupied by the demultiplexing register configuration value corresponding to the function name from the preset demultiplexing array, so as to configure the register address based on the demultiplexing register configuration value, the corresponding bit offset and the number of bits occupied, wherein the bit offset represents the configuration position of the demultiplexing register configuration value corresponding to the function name in the corresponding register address.

[0014] For most chips, the position and number of bits of the demultiplexing register configuration value in the register address are completely consistent. Therefore, for simplicity, a macro definition can be used instead of including it in the preset demultiplexing array. However, for some chips, the position or number of bits of the demultiplexing register configuration value in the register address is not completely consistent. In this embodiment, the bit offset and number of bits occupied by the demultiplexing register configuration value corresponding to the function name can be configured in the preset demultiplexing array, thereby making the demultiplexing method provided in this application applicable to different types of chips and expanding its scope of application.

[0015] In one embodiment, after configuring the register address based on the demultiplexing register configuration value, the method further includes: recording the demultiplexed function names to obtain a demultiplexing record; the demultiplexing record is used to query the usage status of the function corresponding to the function name if a function name is received, and to output a prompt message when it is determined that the function corresponding to the function name is being used.

[0016] In this embodiment of the application, by recording the names of de-reused functions, when the same function name is received again, a prompt message indicating that the function corresponding to the function name is being used can be sent to the user, which facilitates the user's analysis and identification of the problem and improves the efficiency and accuracy of the user's de-reuse work.

[0017] In one embodiment, the step of demultiplexing the function corresponding to the function name based on the preset demultiplexing array includes: when it is determined that the function name includes a wildcard, determining a function name group based on the preset wildcard rule corresponding to the wildcard, the wildcard, and the function name; and demultiplexing the function corresponding to each function name in the function name group based on the preset demultiplexing array.

[0018] In this embodiment of the application, when a function name carrying a wildcard is received, the corresponding function name group can be determined by the wildcard, the preset wildcard rule and the function name. Then, the function name in the function name group can be demultiplexed by the preset demultiplexing array to realize the batch demultiplexing of function names and improve the demultiplexing efficiency.

[0019] In one embodiment, the step of demultiplexing the function corresponding to the function name based on the preset demultiplexing array includes: when it is determined that the function name includes a connector, determining a function name group based on the preset connector rule corresponding to the connector, the connector, and the function name; and demultiplexing the function corresponding to each function name in the function name group based on the preset demultiplexing array.

[0020] In this embodiment of the application, when a function name carrying a connector is received, the corresponding function name group can be determined by the connector, the preset connector rule and the function name. Then, each function name in the function name group can be demultiplexed by the preset demultiplexing array to realize batch demultiplexing of function names and improve demultiplexing efficiency.

[0021] Secondly, embodiments of this application provide a demultiplexing device, comprising: a receiving module for receiving the function name of a function to be demultiplexed; and a demultiplexing module for demultiplexing the function corresponding to the function name based on a preset demultiplexing array, wherein the preset demultiplexing array includes the function name, register address, and demultiplexing register configuration value, and the correspondence between the three, and the demultiplexing is used to configure the register address corresponding to the pin based on the demultiplexing register configuration value, so that the pin implements the function corresponding to the function name.

[0022] Thirdly, embodiments of this application provide a GPIO module connected to the demultiplexing device described in the second aspect. The GPIO module includes: a sending unit for sending the function name of the function to be demultiplexed to the demultiplexing device; the demultiplexing device for demultiplexing the function corresponding to the function name; and a command unit for controlling the pins of the demultiplexed function corresponding to the function name based on the received command.

[0023] Fourthly, embodiments of this application provide an electronic device including a memory and a processor, wherein the memory stores computer-readable instructions, and when executed by the processor, the computer-readable instructions cause the processor to perform the method as described in any of the first aspects.

[0024] Fifthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when run on a computer, causes the computer to perform the demultiplexing method as described in the first aspect. Attached Figure Description

[0025] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0026] Figure 1 A flowchart of a demultiplexing method provided in an embodiment of this application;

[0027] Figure 2 A schematic diagram of a preset demultiplexing array provided in an embodiment of this application;

[0028] Figure 3 This is a schematic diagram of a demultiplexing device provided in an embodiment of this application;

[0029] Figure 4 A schematic diagram of a GPIO module provided in an embodiment of this application;

[0030] Figure 5 This is a schematic diagram of an electronic device provided in an embodiment of this application.

[0031] Icons: Demultiplexing device 200; receiving module 210; demultiplexing module 220; GPIO module 300; transmitting unit 310; command unit 320; electronic device 400; processor 410; memory 420. Detailed Implementation

[0032] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0033] Please see Figure 1 , Figure 1 This is a flowchart illustrating a demultiplexing method according to an embodiment of this application. The demultiplexing method provided by this application can be implemented as a driver program. This driver program is located within a chip or stored in an electronic device communicatively connected to the chip. Through this driver program, demultiplexing of chip pins can be achieved. The demultiplexing method includes:

[0034] S110, Receive the function name of the function to be demultiplexed.

[0035] S120, demultiplex the functions corresponding to the function names based on the preset demultiplexing array.

[0036] For S110, in this embodiment, the function name corresponding to the function to be demultiplexed can be received by the user. It can be understood that one function name corresponds to one function.

[0037] For S110, in this embodiment, the system can also receive the function name carrying a wildcard corresponding to the function to be demultiplexed, input by the user. The function name carrying a wildcard can be used to determine a function name group based on the wildcard, a preset wildcard rule, and the function name itself, with each function name in the group corresponding to one function. In some embodiments, the system can also receive the function name carrying a connector corresponding to the function to be demultiplexed, input by the user. The function name carrying a connector can be used to determine a function name group based on the connector, a preset connector rule, and the function name itself, with each function name in the group corresponding to one function. The specific implementation of wildcards and connectors will be discussed later and will not be described here.

[0038] In this application, users can demultiplex chip pins simply by entering the function name, thereby effectively reducing the process of users searching for the corresponding pins and register configuration information through the datasheet.

[0039] Prior to S120, in the scenario addressed by this application, a single pin of a chip might need to implement different functions, and a pin could only implement one function at a time. Each pin had a corresponding demultiplexing register, the configuration of which characterized the function the pin could perform. The demultiplexing register configuration was typically a single value. Therefore, when a pin needed to switch from its current function to another, the demultiplexing register configuration value could be modified to match the value corresponding to the desired function, thus enabling the pin to perform the required function. This process of modifying the demultiplexing register configuration value according to the function is also known as demultiplexing.

[0040] In this embodiment, the preset demultiplexing array includes function names, register addresses, demultiplexing register configuration values, and the correspondence between them. The register address represents the location of the register, each register is used to enable its corresponding pin to implement the function configured therein, and the demultiplexing register configuration value represents the function implemented by the register. The chip's function is represented in the preset demultiplexing array as a function name, and the implementation of the function can be described by configuring the demultiplexing register configuration value into the register address corresponding to the pin. Through the preset demultiplexing array, the driver can directly obtain the required information from the preset demultiplexing array and then configure the demultiplexing register configuration value into the register address corresponding to the pin, thereby achieving demultiplexing of the chip pins.

[0041] In some embodiments, where the position or number of bits of the chip demultiplexing register configuration value in the register address is not completely consistent, the preset demultiplexing array should also include the configuration position (or "bit offset") and the number of bits occupied by the demultiplexing register configuration value. The specific details of the bit offset and the number of bits occupied will be elaborated later and will not be repeated here.

[0042] In one embodiment, a preset demultiplexing array can be pre-constructed. Constructing the preset demultiplexing array includes: obtaining a preset datasheet, which includes the demultiplexable function name and demultiplexing register address and its configuration value, configuration position, and number of bits for each pin; extracting demultiplexing information from the datasheet, which includes the function name, register address, demultiplexing register configuration value, and the correspondence between the three. If the position or number of bits of the chip's demultiplexing register configuration value in the register address is not completely consistent, it may also include the configuration position (or "bit offset") and number of bits of the demultiplexing register configuration value, as well as the correspondence between it and the previous three; and constructing the preset demultiplexing array based on the demultiplexing information.

[0043] In this embodiment, the datasheet is a description document for the chip pins, including a functional description of each chip pin, such as the chip pin name, function name, register address, register configuration value, its configuration location and the number of bits occupied, as well as the correspondence between the information, usually listed in tabular form. This datasheet can be a description document for the chip pins provided or publicly available by the chip manufacturer; the acquisition of the datasheet is not described here. In this application, the demultiplexing information includes at least each function name and its corresponding register address, and the demultiplexing register configuration value corresponding to each function name. The demultiplexing register configuration value is used to characterize the function that can be achieved by configuring the corresponding register address, and is usually represented by a numerical value, such as 0, 1, 2, etc., with each value corresponding to one function of register demultiplexing.

[0044] In this embodiment, the demultiplexing information required for demultiplexing can be extracted from the datasheet. The demultiplexing information includes the function name, register address, demultiplexing register configuration value, and the correspondence between the three. If the position or number of bits of the chip's demultiplexing register configuration value in the register address is not completely consistent, it also includes the bit offset and number of bits occupied by the demultiplexing register configuration value, as well as the correspondence between it and the previous three. It is understandable that when demultiplexing a function, it is necessary to determine the pin corresponding to the function (represented by the function name), and then determine the register address corresponding to the pin. After determining the register address, the configuration value of the register can be modified according to the demultiplexing register configuration value, its configuration position, and the number of bits occupied to configure the pin so that the pin can perform the corresponding function. Therefore, the preset demultiplexing array should at least include the function name, register address, demultiplexing register configuration value, and the correspondence between the three. When constructing the preset demultiplexing array, demultiplexing information including the function name, register address, and demultiplexing register configuration value can be extracted from the datasheet. If the position or number of bits of the chip's demultiplexing register configuration value in the register address is not completely consistent, the configuration position (which can be represented by "bit offset") and the number of bits occupied by the demultiplexing register configuration value should also be extracted.

[0045] In some embodiments, when the bit offset or number of bits in the chip demultiplexing register configuration value is exactly the same in the register address, the bit offset and the number of bits occupied can be predefined by macro definition and do not need to be included in the preset demultiplexing array, thereby increasing the simplicity and readability of the preset demultiplexing array. Macro definitions can refer to the prior art and will not be elaborated here.

[0046] Extracting demultiplexing information from the data manual can be achieved in different ways. For example, it can be extracted from the data manual through a pre-built extraction script or through text recognition. For specific implementation details, please refer to existing technologies, which will not be elaborated here.

[0047] In one embodiment, before extracting demultiplexing information from the datasheet, the format of the datasheet can be converted to a preset format so that the demultiplexing information can be extracted based on the preset format datasheet.

[0048] Since different chip manufacturers may provide datasheets in different file formats, such as Word documents, PDF files, or Excel spreadsheets, this embodiment addresses this by first converting the datasheets to a preset format to extract demultiplexing information. Alternatively, as an optional extraction method, the datasheets can be manually preprocessed to generate a simple and easy-to-process file format (the preset format) before using a script for extraction.

[0049] It is understandable that converting data manuals of different formats into a preset format can unify the file format of extractable data. As a result, open-source or self-written tools or scripts can be used for unified processing, improving the compatibility and efficiency of decomposing and extracting information from data manuals of different formats.

[0050] Generally, chip manufacturers maintain their own style in providing chip datasheets. Therefore, after designing a scheme for extracting and demultiplexing information for a chip, it can be applied to other chips from the same manufacturer with slight modifications or no modifications, further improving the compatibility and efficiency of this embodiment.

[0051] The default format can be one of the different file formats. For example, common default formats are Excel spreadsheets, CSV files, etc. There are many publicly available tools and scripts for parsing these two formats, which will not be elaborated here.

[0052] After extracting the demultiplexing information, this information can be saved as an array to obtain a preset demultiplexing array. Please refer to [link to relevant documentation]. Figure 2 , Figure 2 This is a schematic diagram of a preset demultiplexing array provided in an embodiment of this application.

[0053] To facilitate understanding, a pre-defined demultiplexing array implementation method is provided here, such as... Figure 2 In the preset demultiplexing array shown, the first column RegAddr is the address of the register, the second column FuncCount is the number of functions multiplexed by the register address (corresponding to a certain pin of the chip), which corresponds to the number of structure array members in the third column, and the third column FunctionInfo_s is a structure array of function names and corresponding demultiplexing register configuration values. Figure 2 The demultiplexing array shown is applicable when the chip's demultiplexing register configuration values ​​have identical positions or bit widths in the register address; that is, it does not include the bit offset and number of bits occupied for each function name's demultiplexing register configuration value. In some embodiments, when the chip's demultiplexing register configuration values ​​have identical positions or bit widths in the register address, for simplicity and readability, the bit offset and number of bits occupied can be predefined using macros. It is understood that... Figure 2 The preset demultiplexing array shown is merely an example and should not be construed as limiting this application.

[0054] In some embodiments, the preset demultiplexing array may include different arrays, each of which may be configured with different information. Specifically, the preset demultiplexing array may include the aforementioned multiple register addresses, the function name of the function multiplexed by each register address, and the demultiplexing register configuration value corresponding to each function name in a first array. For S120, the register corresponding to the function name and the demultiplexing register configuration value can be determined from the first array, and then the register address is configured based on the demultiplexing register configuration value.

[0055] In one embodiment, when a chip has one function corresponding to multiple pins, the preset demultiplexing array may further include a second array. The second array includes multiple register addresses corresponding to each function name and the enabled register addresses corresponding to each function name. The number of enabled register addresses can be one, that is, each function name has a unique corresponding configurable register address. For S120, it can be first determined whether the function name exists in the second array. If it exists, it indicates that the register address corresponding to the function name in the second array is enabled. Based on the uniquely corresponding register address, the demultiplexing register configuration value corresponding to the function name can be determined based on the first array.

[0056] Since a single function may correspond to multiple pins, configuring pins based on function names can result in multiple configuration methods. In such cases, if only the function name to be demultiplexed is received, the corresponding pin cannot be determined, potentially leading to misconfiguration. Therefore, when a function in the chip corresponds to multiple pins, a second array can be set up, containing only such function names and the actually enabled register addresses from among their respective multiple register addresses. In this second array, for the same function, typically only one enabled register address is defined. This allows for rapid determination of the unique corresponding register address and demultiplexing after receiving the function name, reducing the time spent selecting the required register address from multiple register addresses, thereby improving demultiplexing efficiency and configuration accuracy.

[0057] Currently, chips are designed so that one function can correspond to multiple pins, primarily to facilitate flexible routing during circuit board design based on different application scenarios. Once the circuit schematic is finalized, the correspondence between functions and pins is determined. By setting up a first array and a second array, it is possible to accommodate both cases where one function corresponds to only one pin and cases where one function corresponds to multiple pins. After the circuit schematic is finalized, the corresponding pin functions are determined. The chip datasheet can be consulted to determine the actual activated register addresses for those function names that correspond to multiple pins, and the function names and actual activated register addresses are then entered into the second array.

[0058] It should be noted that although it is not common for a single function in a chip to correspond to multiple pins, it is very important because every time the circuit schematic is adjusted, it is necessary to check and verify it carefully. In this embodiment, the activation information of this type of function is specially placed in the second array to facilitate users to check the pins and functions using the second array, effectively avoiding misconfiguration and omission, and improving the user's work efficiency.

[0059] In one embodiment, the preset demultiplexing array further includes the bit offset and the number of bits occupied by the demultiplexing register configuration value in the demultiplexing register address; after receiving the function name to be demultiplexed, the method further includes: determining the bit offset and the number of bits occupied by the demultiplexing register configuration value corresponding to the function name from the preset demultiplexing array, so as to configure the address of the register based on the demultiplexing register configuration value, the corresponding bit offset and the number of bits occupied, wherein the bit offset represents the configuration position of the demultiplexing register configuration value corresponding to the function name in the corresponding register address.

[0060] In the same chip's demultiplexing register, the offsets and / or number of bits occupied by the bits used for demultiplexing may differ. In such cases, the bit offset and number of bits occupied can be used to represent the demultiplexing process. For example, in demultiplexing register address A, where bits 3 to 6 (note: bit indexing starts from 0) are used for demultiplexing, the bit offset is 3, and the number of bits occupied is 4. Similarly, in demultiplexing register address B, where bits 0 to 2 are used for demultiplexing, the bit offset is 0, and the number of bits occupied is 3.

[0061] In this embodiment, the demultiplexing information extracted from the datasheet may include each function name, register address, demultiplexing register configuration value, and its bit offset and number of bits occupied in the register address. When constructing the preset demultiplexing array, the bit offset and number of bits occupied can be included in the preset demultiplexing array, and a correspondence between the bit offset and the number of bits occupied and the function name and register address can be established. Thus, when in use, the bit offset and number of bits occupied corresponding to the function name can be directly obtained from the preset demultiplexing array.

[0062] For S120, after receiving the function name, the chip pins can be made to implement the function corresponding to the function name by demultiplexing the function corresponding to the function name.

[0063] In one embodiment, demultiplexing the pins corresponding to the function name based on a preset demultiplexing array includes: determining the demultiplexing register address and demultiplexing register configuration value of the function corresponding to the function name from the preset demultiplexing array; and configuring the demultiplexing register address based on the demultiplexing register configuration value.

[0064] For example, firstly, the function name can be compared with the function names in the first array of the preset demultiplexing array. If a matching function name exists, the function name is considered valid; otherwise, if no matching function name exists, the function name is considered invalid. A valid function name indicates that the function name corresponds to a function and can be demultiplexed; an invalid function name indicates that the function name is incorrect or the chip does not have the corresponding function. Figure 2 For example, after receiving the function name UART1_TXD, the function name UART1_TXD is searched in the preset demultiplexing array. If the function name UART1_TXD exists, then the function name is valid.

[0065] In some embodiments, when both a first array and a second array exist simultaneously, the second array in the preset demultiplexing array can be searched one by one based on the function name. If the function name exists, the register address corresponding to the function name is obtained. Then, based on the obtained register address and the function name, the first array of the preset demultiplexing array is searched one by one to determine the demultiplexing register configuration value corresponding to the function name in the preset demultiplexing array, as well as the register address corresponding to the function name. If the function name does not exist in the second array of the preset demultiplexing array, the first array of the preset demultiplexing array is searched one by one based on the function name to determine the demultiplexing register configuration value corresponding to the function name in the preset demultiplexing array, as well as the register address corresponding to the function name. Continuing the example above, the function name UART1_TXD is in... Figure 2 In the line where RegAddr is 0x100C000C, we can determine that the corresponding register address is 0x100C000C, and the corresponding register configuration value is 2 (e.g., Figure 2 (The number shown to the left of UART1_TXD).

[0066] Finally, based on the register address and register configuration value obtained earlier, the function corresponding to the function name can be demultiplexed so that the pin can perform the function corresponding to the function name. Continuing the example, the register address is obtained as 0x100C000C, and the register configuration value is 2. Since the bit offset and the number of bits occupied are exactly the same in all registers in this example, the bit offset and the number of bits occupied can be directly determined based on the macro definition. When setting the register, the value corresponding to the macro definition can be directly taken. Assuming the bit offset is 0 and the number of bits occupied is 4, in this example, to demultiplex UART1_TXD, the lower 4 bits of the register at register address 0x100C000C can be configured to 2.

[0067] In one embodiment, after demultiplexing the function name, the demultiplexed function name can be recorded to generate a demultiplexing record.

[0068] In this embodiment, after a function name is demultiplexed, the demultiplexing can be recorded to obtain a demultiplexing record. The demultiplexing record may include information such as the function name, register address, and demultiplexing process name.

[0069] In this embodiment, the demultiplexing record is used to query the usage status of the function corresponding to the received function name, and output a prompt message when it is determined that the function corresponding to the function name is being used.

[0070] In this embodiment, after determining whether the function name is valid, the demultiplexing record can be used to determine whether the function corresponding to the function name is being used by a certain process. If it is being used, a prompt message can be output to facilitate users in troubleshooting demultiplexing conflicts and improve work efficiency and accuracy. In some embodiments, a demultiplexing record query function can also be provided to users, providing information such as the function name in use, the corresponding register address, and the process using the function, so that users can determine the status of a certain pin (corresponding to the register address), such as which function the pin is used for and which process is using it.

[0071] In one embodiment, when it is determined that the function name includes a wildcard, a function name group is determined based on the preset wildcard rule corresponding to the wildcard, the wildcard, and the function name; and the pins corresponding to each function name in the function name group are demultiplexed based on the preset demultiplexing array.

[0072] User-inputted function names can include wildcards, such as "*" or "?". Different wildcards correspond to different wildcard rules to achieve different matching functions. For example, "*" indicates that the wildcard can match any number of characters. For example, "UART*" can match all function names that start with "UART". "?" can match any single character. For example, "GPIO? _5" can match all function names that start with "GPIO", end with "_5", and can have any single character in between.

[0073] In this embodiment, wildcard rules are pre-set. After detecting the use of wildcards in the received function names, the wildcard rule corresponding to the wildcard is determined, thereby identifying the function name group corresponding to the received function name, and thus realizing batch pin function demultiplexing or status query. For example, if a user wants to demultiplex all GPIOs in group 0, assuming there are 32 GPIOs in group 0, without wildcards, the GPIO function names need to be passed in 32 separate steps, or the 32 GPIO function names need to be concatenated with a pre-agreed connector and passed down all at once. The demultiplexing process is complex and prone to errors. If wildcards are used, GPIO0_* can be passed, and all GPIOs in group 0 can be identified by wildcards. Compared with the method of inputting one by one, using wildcards can effectively improve the simplicity and efficiency of batch demultiplexing.

[0074] It should be noted that wildcards can also be used to query the demultiplexing status of function names in batches. When querying the demultiplexing status through demultiplexing records, function names including wildcards can be used, so that the demultiplexing status of each function in the corresponding function name group can be queried at once, simplifying the user's work and improving the user's work efficiency.

[0075] In one embodiment, when it is determined that the function name includes a connector, a function name group is determined based on the preset connector rule corresponding to the connector, the connector, and the function name; and the pins corresponding to each function name in the function name group are demultiplexed based on the preset demultiplexing array.

[0076] User-inputted function names may include connectors, which are symbols used to link multiple function names together. The connector should not contain the same characters as those in the function names; otherwise, the parser cannot distinguish whether it is a connector or part of a function name. Common connectors include "|" and ",". For example, the function name "UART0_TXD|GPIO?_5|I2C0_*" with "|" as the connector contains three function names: UART0_TXD, GPIO?_5, and I2C0_*. GPIO?_5 and I2C0_* include the wildcards mentioned earlier.

[0077] In this embodiment, connector rules are pre-set. After detecting the use of a connector in a received function name, the corresponding connector rule is determined, thereby identifying the function name group corresponding to the received function name. This enables batch demultiplexing of pin functions or status query. For example, if a user wants to demultiplex GPIO0_5, GPIO2_0, UART0_RXD, and UART0_TXD, without using a connector, the function names must be passed in four separate steps. With a connector, only "GPIO0_5|GPIO2_0|UART0_RXD|UART0_TXD" needs to be passed. Compared to the ordinary method, using connectors can further improve the simplicity and efficiency of batch demultiplexing.

[0078] It should be noted that the connector can also be used to query the demultiplexing status of function names in batches. When querying the demultiplexing status through demultiplexing records, function names including the connector can be used, so that the demultiplexing status of each function in the corresponding function name group can be queried at once, simplifying the user's work and improving the user's work efficiency.

[0079] Furthermore, the above demultiplexing method can be implemented as a demultiplexing driver for electronic devices or processing chips. In some embodiments, it can be used for other drivers to call. A board-level support package can also be encapsulated on the demultiplexing driver for use by various applications. The specific functions and encapsulation process of the board-level support package can be found in existing technologies and will not be elaborated here.

[0080] In this embodiment, the preset demultiplexing array includes a function name, a register address, a demultiplexing register configuration value, and the correspondence between the three. When demultiplexing is required, only the function name of the function to be demultiplexed needs to be received from the user, and the function can be demultiplexed through the preset demultiplexing array. Compared to the prior art of consulting relevant materials to determine the corresponding pin, register address, and demultiplexing register configuration value for a function name, this application allows the user to achieve demultiplexing simply by inputting the function name of the function to be demultiplexed. This reduces the time users spend searching for demultiplexing-related information and improves demultiplexing efficiency and accuracy.

[0081] Based on the same inventive concept, this application also provides a demultiplexing device. Please refer to [link to relevant documentation]. Figure 3 , Figure 3 This is a schematic diagram of a demultiplexing device provided in an embodiment of this application. The demultiplexing device includes:

[0082] The receiving module 210 receives the function name of the function to be demultiplexed.

[0083] The demultiplexing module 220 is used to demultiplex the function corresponding to the function name based on a preset demultiplexing array. The preset demultiplexing array includes the function name, register address and demultiplexing register configuration value and the correspondence between the three. Demultiplexing is used to configure the register address corresponding to the pin based on the demultiplexing register configuration value so that the pin implements the function corresponding to the function name.

[0084] The demultiplexing module 220 is also used to determine the register address and demultiplexing register configuration value corresponding to the function name from the preset demultiplexing array; the preset demultiplexing array includes a first array, which includes multiple register addresses, the function name of the function multiplexed by each register address and the demultiplexing register configuration value corresponding to each function name, wherein each register address corresponds to a pin; the register address is configured based on the demultiplexing register configuration value.

[0085] The preset demultiplexing array further includes a second array, which includes a function name corresponding to multiple register addresses and the corresponding enabled register addresses. The demultiplexing module 220 is further configured to, if the function name is configurable among multiple register addresses, determine the unique register address corresponding to the function name based on the second array; and determine the demultiplexing register configuration value corresponding to the function name based on the determined unique register address and the first array.

[0086] The preset demultiplexing array may also include the bit offset and number of bits occupied by the demultiplexing register configuration value in the demultiplexing register. The demultiplexing module 220 is further used to determine the bit offset and number of bits occupied by the demultiplexing register configuration value corresponding to the function name from the preset demultiplexing array, so as to configure the register address based on the demultiplexing register configuration value, the corresponding bit offset and the number of bits occupied. The bit offset represents the configuration position of the demultiplexing register configuration value corresponding to the function name in the corresponding register.

[0087] In one embodiment, the demultiplexing module 220 is further configured to record the demultiplexed function names to obtain a demultiplexing record; the demultiplexing record is used to query the usage status of the function corresponding to the function name if a function name is received, and to output a prompt message when it is determined that the function corresponding to the function name is being used.

[0088] In one embodiment, the demultiplexing module 220 is further configured to, when determining that the function name includes a wildcard, determine a function name group based on the preset wildcard rule corresponding to the wildcard, the wildcard and the function name; and demultiplex the functions corresponding to each function name in the function name group based on the preset demultiplexing array.

[0089] In one embodiment, the demultiplexing module 220 is further configured to, when determining that the function name includes a connector, determine a function name group based on the preset connector rule corresponding to the connector, the connector and the function name; and demultiplex the functions corresponding to each function name in the function name group based on the preset demultiplexing array.

[0090] It is understandable that the functions implemented by the demultiplexing device 200 correspond to the demultiplexing method. For specific implementation details, please refer to the demultiplexing method, which will not be elaborated here.

[0091] Based on the same inventive concept, this application provides a GPIO module. Please refer to [link / reference]. Figure 4 , Figure 4 This is a schematic diagram of a GPIO module provided in an embodiment of this application. The GPIO module is used to connect to a demultiplexing device, the function of which can be referred to in the foregoing embodiments and will not be repeated here.

[0092] The GPIO module 300 includes a transmitting unit 310 and a command unit 320, wherein the transmitting unit 310 is connected to the demultiplexing device.

[0093] The sending unit 310 is used to send the function name of the function to be demultiplexed to the demultiplexing device, and the demultiplexing device is used to demultiplex the function corresponding to the function name.

[0094] Command unit 320 is used to control the pins after demultiplexing the function name corresponding to the received command.

[0095] GPIO is widely used in embedded development and often shares a pin with other functions. Before operating on it, it must be demultiplexed. In this embodiment, the GPIO module sends the name of the GPIO function to be demultiplexed to the receiving module 210 of the demultiplexing device via the sending unit 310. The demultiplexing module 220 of the demultiplexing device then performs the demultiplexing operation. In embedded development, the GPIO module frequently needs to perform demultiplexing operations. In this embodiment, the GPIO module is connected to a demultiplexing device capable of executing the demultiplexing method provided in this application. This allows the demultiplexing device to demultiplex the functions required by the GPIO module. Thus, by sharing the demultiplexing device with other modules in the system, the cumbersome and inefficient demultiplexing operation required by the GPIO module itself is eliminated, improving the simplicity and accuracy of the GPIO module implementation and increasing its working efficiency.

[0096] After the GPIO pin function is demultiplexed by the sending unit 310, commands to operate on the GPIO pin can be sent to the command unit 320 to achieve a certain operation. For example, a command to set the direction can be sent to modify the GPIO input or output attribute; a command to read the GPIO level can be sent to read the current GPIO state; a command to set the GPIO value can be sent to output a high or low level when the GPIO direction is set to output. For more information on GPIO, please refer to existing technologies; further details will not be provided here.

[0097] Please refer to Figure 5 This application also provides an electronic device 400, which can serve as the execution subject of the aforementioned demultiplexing method, including: a processor 410 and a memory 420 communicatively connected to the processor 410.

[0098] The memory 420 stores instructions that can be executed by the processor 410. The instructions are executed by the processor 410 to enable the processor 410 to perform the demultiplexing method in the foregoing embodiments, implement the demultiplexing device in the foregoing embodiments, or implement the function of the GPIO module in the foregoing embodiments.

[0099] The components of processor 410 and memory 420 are electrically connected directly or indirectly to each other to enable data transmission or interaction.

[0100] Processor 410 can be an integrated circuit chip with signal processing capabilities. Processor 410 can be a general-purpose processor, including a CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be a digital signal processor, application-specific integrated circuit, off-the-shelf programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor.

[0101] The memory 420 may include, but is not limited to, RAM (Random Access Memory), ROM (Read Only Memory), PROM (Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electric Erasable Programmable Read-Only Memory), NOR Flash, NAND Flash, eMMC (Embedded Multi Media Card), etc.

[0102] Based on the same inventive concept, embodiments of this application also provide a computer-readable storage medium storing a computer program thereon, which executes the methods provided in the above embodiments when the computer program is run.

[0103] The storage medium can be any available medium that a computer can access, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., SSDs (Solid State Disks)).

[0104] In the embodiments provided in this application, it should be understood that the disclosed methods and apparatus can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. The functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.

[0105] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM (Read-Only Memory), RAM (Random Access Memory), magnetic disks, or optical disks.

[0106] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0107] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

Claims

1. A demultiplexing method, characterized in that, include: Receive the function name of the function to be demultiplexed; The function corresponding to the function name is demultiplexed based on a preset demultiplexing array. The preset demultiplexing array includes the function name, register address, demultiplexing register configuration value, and the correspondence between the three. The demultiplexing is used to configure the register address corresponding to the pin based on the demultiplexing register configuration value corresponding to the function name, so that the pin can implement the function corresponding to the function name. The step of demultiplexing the function corresponding to the function name based on a preset demultiplexing array includes: determining the register address and demultiplexing register configuration value corresponding to the function name from the preset demultiplexing array; the preset demultiplexing array includes a first array, the first array including multiple register addresses, the function name of the function multiplexed by each register address, and the demultiplexing register configuration value corresponding to each function name, wherein each register address corresponds to a pin; configuring the register address based on the demultiplexing register configuration value; The preset demultiplexing array further includes a second array, which includes multiple register addresses corresponding to each function name and an enabled register address corresponding to each function name. Determining the register address and demultiplexing register configuration value corresponding to the function name from the preset demultiplexing array includes: if the function name is configurable among multiple register addresses, then determining the unique register address corresponding to the function name based on the second array; and determining the demultiplexing register configuration value corresponding to the function name based on the unique register address and the first array.

2. The demultiplexing method according to claim 1, characterized in that, The preset demultiplexing array also includes the bit offset and the number of bits occupied by the demultiplexing register configuration value in the demultiplexing register address; After receiving the function name of the function to be demultiplexed, the method further includes: determining the bit offset and the number of bits occupied corresponding to the demultiplexing register configuration value corresponding to the function name from the preset demultiplexing array, so as to configure the register address based on the demultiplexing register configuration value, the corresponding bit offset and the number of bits occupied, wherein the bit offset represents the configuration position of the demultiplexing register configuration value corresponding to the function name in the corresponding register address.

3. The demultiplexing method according to claim 1, characterized in that, After configuring the register address based on the demultiplexing register configuration value, the method further includes: recording the function name that has been demultiplexed to obtain a demultiplexing record; The demultiplexing record is used to query the usage status of the function corresponding to the received function name, and output a prompt message when it is determined that the function corresponding to the function name is being used.

4. The method according to claim 1, characterized in that, The step of demultiplexing the function corresponding to the function name based on the preset demultiplexing array includes: When it is determined that the function name includes a wildcard, a function name group is determined based on the preset wildcard rule corresponding to the wildcard, the wildcard, and the function name; The functions corresponding to each function name in the function name group are demultiplexed based on a preset demultiplexing array.

5. The method according to claim 1, characterized in that, The step of demultiplexing the function corresponding to the function name based on the preset demultiplexing array includes: When it is determined that the function name includes a connector, a function name group is determined based on the preset connector rule corresponding to the connector, the connector, and the function name; The functions corresponding to each function name in the function name group are demultiplexed based on a preset demultiplexing array.

6. A demultiplexing device, characterized in that, include: The receiving module is used to receive the function name of the function to be demultiplexed; The demultiplexing module is used to demultiplex the function corresponding to the function name based on a preset demultiplexing array. The preset demultiplexing array includes the function name, register address, demultiplexing register configuration value, and the correspondence between the three. The demultiplexing is used to configure the register address corresponding to the pin based on the demultiplexing register configuration value so that the pin implements the function corresponding to the function name. The demultiplexing module is used to determine the register address and demultiplexing register configuration value corresponding to the function name from the preset demultiplexing array; the preset demultiplexing array includes a first array, which includes multiple register addresses, the function name of the function multiplexed by each register address, and the demultiplexing register configuration value corresponding to each function name, wherein each register address corresponds to a pin; the register address is configured based on the demultiplexing register configuration value; The preset demultiplexing array further includes a second array, which includes multiple register addresses corresponding to each function name and an enabled register address corresponding to each function name. The demultiplexing module is further configured to: if the function name is configurable among multiple register addresses, determine the unique register address corresponding to the function name based on the second array; and determine the demultiplexing register configuration value corresponding to the function name based on the unique register address and the first array.

7. A GPIO module, characterized in that, Connected to the demultiplexing device as described in claim 6, the GPIO module includes: The sending unit is used to send the function name of the function to be demultiplexed to the demultiplexing device; the demultiplexing device is used to demultiplex the function corresponding to the function name; The command unit is used to control the pins after the function name is demultiplexed based on the received command.

8. An electronic device, characterized in that, The method includes a memory and a processor, wherein the memory stores computer-readable instructions that, when executed by the processor, cause the processor to perform the method as described in any one of claims 1-5.

9. A computer-readable storage medium, characterized in that, The readable storage medium stores a computer program that, when run on a computer, causes the computer to perform the method as described in any one of claims 1-5.