Register access method and device of embedded system
By presetting the general CLI and parsing layer in the platform and driver layers of embedded systems, converting and judging register access requests, and directly contacting the register adapter layer to run command statements, the long time of connecting to the logging and registers in embedded device development is solved. API unfriendly problem, enabling rapid development and friendly interfaces.
Patent Information
- Application Number
- CN202411567479.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-11
AI Technical Summary
In the development of embedded devices, the existing technology has led to a significant extension of the joint debugging time between the platform layer and the driver layer, affecting the progress of software development, and the register API is not friendly to developers and it is difficult to quickly locate and solve problems.
By presetting registers in the platform layer and the driver layer to read the general CLI and general CLI parsing layers, convert the user-input register access request into an identifiable command statement, and determine whether the command statement is supported for operation. If supported, the direct contact register adapter layer runs command statements to achieve access to the target register. If not supported, a prompt message is sent to the user.
This method reduces software development time, simplifies the register access process, and provides a more friendly command interface to help developers quickly locate and resolve problems.
Smart Images

Figure CN119415150A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software development, and in particular to a register access method and device for an embedded system. Background Art
[0002] In the development of embedded devices, registers are widely used, such as LED lighting registers, registers in FPGA (Field Programmable Gate Array) and other devices. The use of registers is also very important. It is often necessary to read the current device status according to the value of the register and adjust the system operation according to the sent value. Scenarios for configuring registers usually include the system automatically sending the default configuration during initialization and the user using the platform layer such as CLI / WEB / MIB to send the configuration, thereby triggering the configuration register. Regardless of whether it is an initialization or user-sent configuration scenario, the development process is usually separated from the platform layer and the driver layer. For example, in order to complete a configuration, the platform layer needs to write the corresponding CLI / WEB / MIB and other business codes, and then send the parameters to the driver layer layer by layer according to the original layer architecture. The driver layer completes the configuration of the registers. For details, please refer to Figure 1 The general configuration flow of registers is shown.
[0003] During the software development process, the platform layer is completed by platform developers, and the driver layer is completed by driver developers. Based on the existing conventional register configuration process, it is necessary to wait for the platform layer and the driver layer to be developed before performing joint debugging between the platform layer and the driver layer (joint debugging can realize the testing of related codes), which greatly prolongs the time for completing joint debugging, prolongs the software development time, and affects the software development progress. Summary of the invention
[0004] The present application provides a register access method and device for an embedded system, aiming to reduce the software development time of the embedded system.
[0005] In order to achieve the above objectives, this application provides the following technical solutions:
[0006] A register access method for an embedded system, comprising:
[0007] Using the register read general CLI preset in the platform layer, the register access request input by the user is converted to obtain a command statement that can be recognized by the register adaptation layer; the register read general CLI includes conversion logic written based on the general language infrastructure;
[0008] Using a register general CLI parsing layer preset in the driver layer, determining whether the command statement is supported for operation; the register general CLI parsing layer includes pre-configured register attributes;
[0009] If the command statement is supported for execution, triggering the register adaptation layer to directly execute the command statement to implement access to a target register; the target register is the register indicated by the register access request;
[0010] If the command statement cannot be supported for execution, a prompt message is sent to the user; the prompt message is used to remind the user that the target register access fails.
[0011] Optionally, using a register general CLI parsing layer preset in the driver layer to determine whether the command statement is supported for operation includes:
[0012] Parsing the command statement using a register universal CLI parsing layer preset in the driver layer to obtain corresponding target attributes;
[0013] Matching the target attribute with the register attribute to obtain a corresponding matching result;
[0014] If the matching result is successful, determining that the command statement is supported for execution;
[0015] If the matching result is failure, it is determined that the command statement cannot be supported for execution.
[0016] Optionally, the register attribute includes a register type and a corresponding register address, and matching the target attribute with the register attribute to obtain a corresponding matching result includes:
[0017] In the case where the register access request is a read request, determining a corresponding target type and a target address based on the target attribute;
[0018] If the target type is the same as the register type, and the target address is the same as the register address, determining that the match result between the target attribute and the register attribute is successful;
[0019] If the target type is different from the register type, and / or the target address is different from the register address, it is determined that the matching result between the target attribute and the register attribute is a failure.
[0020] Optionally, the register attribute includes a register type and a corresponding register address and a value range, and the target attribute is matched with the register attribute to obtain a corresponding matching result, including:
[0021] In the case where the register access request is a write request, determining a corresponding target type, a target address, and a target value based on the target attribute;
[0022] If the target type is the same as the register type, the target address is the same as the register address, and the target value is within the numerical range, determining that the match result between the target attribute and the register attribute is successful;
[0023] If the target type is different from the register type, and / or the target address is different from the register address, and / or the target value is not within the numerical range, it is determined that the matching result between the target attribute and the register attribute is a failure.
[0024] A register access device for an embedded system, comprising:
[0025] A statement conversion unit, used to convert the register access request input by the user using the register reading general CLI preset in the platform layer to obtain a command statement that can be recognized by the register adaptation layer; the register reading general CLI includes a conversion logic written based on the general language infrastructure;
[0026] A statement judgment unit, used to judge whether the command statement is supported for operation by using a register general CLI parsing layer preset in the driver layer; the register general CLI parsing layer includes pre-configured register attributes;
[0027] A command execution unit, configured to trigger the register adaptation layer to directly execute the command statement if the command statement is supported for execution, so as to access a target register; the target register is the register indicated by the register access request;
[0028] A failure reminder unit is used to send a reminder message to the user if the command statement cannot be supported for operation; the reminder message is used to remind the user that the target register access fails.
[0029] Optionally, the statement judgment unit is specifically used to:
[0030] Parsing the command statement using a register universal CLI parsing layer preset in the driver layer to obtain corresponding target attributes;
[0031] Matching the target attribute with the register attribute to obtain a corresponding matching result;
[0032] If the matching result is successful, determining that the command statement is supported for execution;
[0033] If the matching result is failure, it is determined that the command statement cannot be supported for execution.
[0034] Optionally, the register attribute includes a register type and a corresponding register address, and the statement judgment unit is specifically used to:
[0035] In the case where the register access request is a read request, determining a corresponding target type and a target address based on the target attribute;
[0036] If the target type is the same as the register type, and the target address is the same as the register address, determining that the match result between the target attribute and the register attribute is successful;
[0037] If the target type is different from the register type, and / or the target address is different from the register address, it is determined that the matching result between the target attribute and the register attribute is a failure.
[0038] Optionally, the register attribute includes a register type and a corresponding register address and a value range, and the statement judgment unit is specifically used to:
[0039] In the case where the register access request is a write request, determining a corresponding target type, a target address, and a target value based on the target attribute;
[0040] If the target type is the same as the register type, the target address is the same as the register address, and the target value is within the numerical range, determining that the match result between the target attribute and the register attribute is successful;
[0041] If the target type is different from the register type, and / or the target address is different from the register address, and / or the target value is not within the numerical range, it is determined that the matching result between the target attribute and the register attribute is a failure.
[0042] A storage medium comprises a stored program, wherein the program executes the register access method of the embedded system when being run by a processor.
[0043] An electronic device, comprising: a processor, a memory and a bus; the processor and the memory are connected via the bus;
[0044] The memory is used to store programs, and the processor is used to run programs, wherein the program executes the register access method of the embedded system when the processor runs it.
[0045] The technical solution provided by the present application utilizes the register reading general CLI in the platform layer to convert the register access request to obtain a command statement that can be recognized by the register adaptation layer. The register general CLI parsing layer in the driver layer is used to determine whether the command statement is supported for operation. If the command statement is supported for operation, the register adaptation layer is triggered to directly run the command statement to achieve access to the target register. If the command statement is not supported for operation, a prompt message is sent to the user. The present application converts the register access request into the corresponding command statement through the register reading general CLI, and uses the register general CLI parsing layer to determine whether the command statement is supported for operation. When the command statement is supported for operation, the register adaptation layer is triggered to directly run the command statement to achieve direct access to the register adaptation layer, thereby exposing the register access problem in advance to the greatest extent to shorten the software development time, and provide developers with a more convenient and fast command-friendly way to directly access registers. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0047] Figure 1 A schematic diagram of a conventional register configuration process provided in an embodiment of the present application;
[0048] Figure 2 A flow chart of a register access method for an embedded system provided in an embodiment of the present application;
[0049] Figure 3 A flowchart of another register access method for an embedded system provided in an embodiment of the present application;
[0050] Figure 4 A flowchart of another register access method for an embedded system provided in an embodiment of the present application;
[0051] Figure 5 A flowchart of another register access method for an embedded system provided in an embodiment of the present application;
[0052] Figure 6 A schematic diagram of the architecture of a register access device for an embedded system provided in an embodiment of the present application;
[0053] Figure 7 A schematic diagram of another conventional register configuration process provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0055] In this application, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, the elements defined by the sentence "comprise one..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0056] The applicant found that according to Figure 1 The following problems exist when using the conventional register configuration process shown in the figure for software development.
[0057] (1) The joint debugging between the platform layer and the driver layer is greatly restricted. Driver development engineers need to wait for the platform layer to be developed before they can start to debug the driver adaptation code for register reading and writing. Figure 1 ), otherwise there is no platform layer call to trigger register configuration.
[0058] (2) Difficulty in locating system defects (bugs): If a problem needs to be located, although the debugging switch of the driver and platform can be turned on to capture logs (logs), usually the upper-level user configures a command line, which is actually converted into more than one configuration sent to the register. A large number of logs cause interference. Moreover, when multiple register configurations are sent, if there are dependencies between the configurations, the problem is even more confusing. It is not easy to quickly sort out the logical relationship between multiple register configurations and find the configuration with the problem.
[0059] (3) It is not easy to capture information: If the problem occurs on-site, the customer is generally familiar with the WEB and CLI configuration, but usually does not understand the debugging switch and log capture process, let alone the use of the register API (Application Programming Interface). It is very difficult to guide the customer on-site to reproduce the problem and capture information.
[0060] (4) The API is not developer-friendly: The use of the register API is not very developer-friendly. Different systems and different registers have different access commands.
[0061] In response to the above problems discovered by the applicant, an embodiment of the present application discloses a register access method for an embedded system, which is used to effectively solve the above four problems.
[0062] like Figure 2 As shown, it is a flow chart of a register access method of an embedded system provided in an embodiment of the present application, which includes the following steps.
[0063] S201: Using the register reading general CLI preset in the platform layer, convert the register access request input by the user to obtain a command statement that can be recognized by the register adaptation layer.
[0064] The register read universal CLI includes a conversion logic written based on a universal language infrastructure, and the format of the command statement complies with the universal language infrastructure.
[0065] In some examples, the platform layer may be in a state of software development.
[0066] The so-called Common Language Infrastructure (CLI) is an open technical specification that defines a language-independent, cross-architecture operating environment, allowing developers to develop key software in various high-level languages defined in the specification and run the software on different computer architectures without modification.
[0067] In some examples, a register read general CLI may be added to the platform layer to convert the register access request input by the platform layer into a corresponding command statement. Generally speaking, adding a register read general CLI to the platform layer does not have any impact on the logical operation of the platform layer.
[0068] In a possible implementation, the type of register access request includes a read request, and for this purpose, a corresponding general CLI may be set for the read request so as to convert the read request into a corresponding command statement. Specifically, via the general CLI corresponding to the read request, the format of the command statement converted is: registerread{fpga|led|reg_type}reg_add.
[0069] In the command statement corresponding to the read request, the keywords "register" and "read" are fixed, followed by the read / write register category reg_type (such as fpga, led, etc., and new types can be added if there are new types), and then the register address reg_add.
[0070] In a possible implementation, the type of register access request includes a write request, and for this purpose, a corresponding general CLI may be set for the write request so as to convert the write request into a corresponding command statement. Specifically, via the general CLI corresponding to the write request, the format of the command statement converted is: registerwrite{fpga|led|reg_type}reg_addreg_data.
[0071] In the command statement corresponding to the write request, the keywords "register" and "write" are fixed, followed by the read / write register category reg_type (such as fpga, led, etc., and new types can be added if there are new types), then the register address reg_add, and finally the data reg_data sent to the register.
[0072] It should be noted that the data type of the register category is a string type, the data type of the register address is a hexadecimal integer type, and the data type of the data sent to the register is a hexadecimal integer type.
[0073] In some examples, for a read request of a register type of FPGA, the corresponding command statement may be: registerread fpga 0xa0.
[0074] In some examples, for a read request of a register type of LED, the corresponding command statement may be: registerread led 0xa0.
[0075] In some examples, for a write request of a register type of FPGA, the corresponding command statement may be: registerwrite fpga 0xa00x1.
[0076] In some examples, for a write request of a register type of FPGA, the corresponding command statement may be: registerwrite led 0x100x1.
[0077] S202: Using the register general CLI parsing layer preset in the driver layer, determine whether the command statement is supported for operation.
[0078] The register general CLI parsing layer includes pre-configured register attributes. If the command statement is supported for operation, S203 is executed. If the command statement is not supported for operation, S204 is executed.
[0079] In some examples, the driver layer may be in a software development state.
[0080] It should be emphasized that the addition of a register general CLI parsing layer in the driver layer does not affect the logical operation of the driver layer. Figure 1 The "functional module platform layer" shown does not use the complex and large amount of patterned codes of the "driver platform layer". It is judged by the newly added simplified register general CLI parsing layer and directly reaches the core register adaptation layer. In addition, the skipped two code layers are mainly used to complete the coordination between various horizontal modules, with a low error probability, and are not core for register access. They can be directly skipped or not used when designing the register general CLI parsing layer.
[0081] In some examples, the register attributes configured by the register general CLI parsing layer can be added, deleted, modified and checked by technicians according to actual conditions. Generally speaking, configuring register attributes in the driver layer will not affect the logical operation of the driver layer.
[0082] Optionally, the implementation process of using the register general CLI parsing layer preset in the driver layer to determine whether the command statement is supported by the operation can be seen in Figure 3 Steps shown and explanations of the steps.
[0083] S203: Trigger the register adaptation layer to directly execute the command statement to access the target register.
[0084] The target register is the register indicated by the register access request.
[0085] In some examples, for a command statement corresponding to a read request, the command statement can be sent to a register adaptation layer of a driver layer, so that the register adaptation layer calls an API of a target register to read corresponding data and displays the read data on a terminal interface to implement access to the target register.
[0086] In some examples, for a command statement corresponding to a write request, the command statement can be sent to the register adaptation layer of the driver layer, so that the register adaptation layer calls the API of the target register to write the target value to the target register and displays the write success on the terminal interface to achieve access to the target register.
[0087] S204: Send a prompt message to the user.
[0088] The prompt information is used to remind the user that the target register access fails. In a possible implementation, the prompt information can be displayed to the user through the terminal.
[0089] Combination Figure 3 , Figure 4 as well as Figure 5 The method shown in the embodiment of the present application can realize direct access to the register, the process of issuing the register access request is simple, which can shorten the development time of the embedded system, the register reading and writing functions can be shared, regardless of the business modules, the command line is simple and easy to remember, which is more friendly to developers and can effectively solve the four problems mentioned above.
[0090] (1) Solve the problem of limited joint debugging: Driver development engineers do not need to wait for the platform development to be completed before starting debugging. By adding a "register read general CLI" (see Figure 7 As shown in the figure, the register adaptation layer can be directly accessed, and the problems of the register adaptation layer can be exposed in advance to the greatest extent to shorten the development time. Once the adaptation layer is debugged, other "functional module platforms" and "driver platforms" are easy to debug with low difficulty and low error rate. Here, it needs to be explained that when there are new business needs, the register adaptation layer of the driver layer needs to be modified regardless of whether there is a register read general CLI. In addition to this normal modification, for each additional function point, it only takes about ten lines of code to maintain the register read general CLI, which is very convenient.
[0091] (2) Solve the problem of difficult positioning: If you encounter a problem that needs to be located, you can directly use the register read general CLI to read and write registers and view the register values without turning on the debugging switch of the driver and platform. The process is simple and convenient for sorting out ideas. There is no interference from multiple register dependencies, and it is easy to find the configuration with the problem. If you need to configure multiple registers, use the register read general CLI to configure them one by one, and naturally sort out the relationship between the configurations.
[0092] (3) Solve the problem of difficulty in capturing information: If the problem is on-site, the customer does not need to turn on the debug switch and capture a large number of logs. The value of the relevant register can be directly read out using the register reading general CLI. By comparing it with the existing configuration, it becomes easy to analyze the problem.
[0093] (4) Solving the API unfriendly problem: The newly added register reading general CLI has only two commands, which is convenient, easy to remember and very user-friendly. In fact, the differences between different registers are shielded by adding a register general CLI parsing layer and utilizing the existing register adaptation layer.
[0094] The process shown in S201-S204 above converts the register access request into the corresponding command statement by reading the general CLI of the register, and uses the general CLI parsing layer of the register to determine whether the command statement is supported for operation. When the command statement is supported for operation, the register adaptation layer is triggered to directly run the command statement to achieve direct access to the register adaptation layer, thereby exposing the register access problem in advance to the greatest extent to shorten the software development time, and provide developers with a more convenient, fast and almost command-friendly way to directly access registers.
[0095] like Figure 3 As shown, it is a flow chart of a register access method of an embedded system provided in an embodiment of the present application, which includes the following steps.
[0096] S301: parse the command statement using the register general CLI parsing layer preset in the driver layer to obtain the corresponding target attribute.
[0097] The register attributes include register type, register address and value range, and the value range is used to represent the value range of data written into the register.
[0098] It should be noted that for register function expansion, in addition to adding code to the regular register adaptation layer, it is also very convenient to maintain the general register general CLI parsing layer. If there is a newly added register type, after the register adaptation layer code is added, you only need to add a new type string to the reg_type position of the register general CLI parsing layer, and add a few lines of parameter judgment and distribution configuration code for this type in the register general CLI parsing layer. If a new supported address is added to the existing register type or the data support range is expanded, in addition to the regular register adaptation layer modification, you only need to modify the register attributes.
[0099] S302: Match the target attribute with the register attribute to obtain a corresponding matching result.
[0100] Here, matching the target attribute with the register attribute can be understood as comparing whether the target attribute and the register attribute are the same.
[0101] It should be noted that due to different types of register access requests, register attributes may be different. Therefore, it is also necessary to consider the type of register access request and match the target attributes with the register attributes.
[0102] Optionally, when the register access request is a read request, the register attribute includes the register type and the corresponding register address, then the target attribute is matched with the register attribute to obtain the corresponding matching result. For details, see Figure 4 Steps shown and explanations of the steps.
[0103] S303: If the matching result is successful, determine whether the command statement is supported for execution.
[0104] Among them, the matching result is successful, which means that the command statement can be executed successfully and the register can be accessed correctly.
[0105] S304: If the matching result is failure, it is determined that the command statement cannot be supported for execution.
[0106] Among them, the matching result is failure, which can be considered that the command statement fails to run and the register cannot be correctly accessed.
[0107] The above process S301-S304 determines whether the command statement is supported for execution based on the matching of the target attribute and the register attribute.
[0108] like Figure 4 As shown, it is a flow chart of a register access method of an embedded system provided in an embodiment of the present application, which includes the following steps.
[0109] S401: When the register access request is a read request, determine a corresponding target type and a target address based on a target attribute.
[0110] The target attribute includes a corresponding target type and a target address. After the target attribute is parsed, the corresponding target type and target address can be directly determined.
[0111] S402: If the target type is the same as the register type, and the target address is the same as the register address, it is determined that the matching result between the target attribute and the register attribute is successful.
[0112] Among them, the target type is the same as the register type, which can be regarded as the register attribute containing the target type, and the target address is the same as the register address, which can be regarded as the register attribute containing the target address. Therefore, the matching result between the target attribute and the register attribute can be determined to be successful.
[0113] S403: If the target type is different from the register type, and / or the target address is different from the register address, it is determined that the matching result between the target attribute and the register attribute is a failure.
[0114] Among them, the target type is different from the register type, which can be regarded as the register attribute not containing the target type, and the target address is different from the register address, which can be regarded as the register attribute not containing the target address. Therefore, it can be determined that the matching result between the target attribute and the register attribute is a failure.
[0115] The above process shown in S401-S403 can use the comparison between the target type and the register type, and the comparison between the target address and the register address to determine the matching result between the target attribute and the register attribute.
[0116] like Figure 5 As shown, it is a flow chart of a register access method of an embedded system provided in an embodiment of the present application, which includes the following steps.
[0117] S501: When the register access request is a write request, determine the corresponding target type, target address, and target value based on the target attribute.
[0118] The target attributes include the corresponding target type, target address and target value. After the target attributes are parsed, the corresponding target type, target address and target value can be directly determined.
[0119] It should be noted that the target value is the value corresponding to the data written into the register.
[0120] S502: If the target type is the same as the register type, the target address is the same as the register address, and the target value is within the numerical range, it is determined that the matching result between the target attribute and the register attribute is successful.
[0121] Among them, the target type is the same as the register type, which can be regarded as the register attribute containing the target type; the target address is the same as the register address, which can be regarded as the register attribute containing the target address; the target value is within the numerical range, which can be regarded as the target value is valid. Therefore, the matching result between the target attribute and the register attribute can be determined to be successful.
[0122] S503: If the target type is different from the register type, and / or the target address is different from the register address, and / or the target value is not within the numerical range, it is determined that the matching result between the target attribute and the register attribute is a failure.
[0123] Among them, the target type is different from the register type, which can be regarded as the register attribute not containing the target type; the target address is the same as the register address, which can be regarded as the register attribute not containing the target address; the target value is within the numerical range, which can be regarded as the target value is wrong. Therefore, it can be determined that the matching result between the target attribute and the register attribute is a failure.
[0124] The process shown in S501-S503 above can determine the matching result between the target attribute and the register attribute by comparing the target type with the register type, comparing the target address with the register address, and comparing the target value with the value range.
[0125] like Figure 6 As shown, it is a schematic diagram of the architecture of a register access device of an embedded system provided in an embodiment of the present application, including the units shown below.
[0126] The statement conversion unit 100 is used to convert the register access request input by the user using the register reading general CLI preset in the platform layer to obtain a command statement that can be recognized by the register adaptation layer; the register reading general CLI includes a conversion logic written based on the general language infrastructure.
[0127] The statement judgment unit 200 is used to judge whether the command statement is supported by operation by using the register general CLI parsing layer preset in the driver layer; the register general CLI parsing layer includes pre-configured register attributes.
[0128] The command execution unit 300 is used to trigger the register adaptation layer to directly execute the command statement if the command statement is supported for execution, so as to access the target register; the target register is the register indicated by the register access request.
[0129] The failure reminder unit 400 is used to send a reminder message to the user if the command statement cannot be supported for execution; the reminder message is used to remind the user of the failure of access to the target register.
[0130] Optionally, the statement judgment unit 200 is specifically used to: use the register general CLI parsing layer preset in the driver layer to parse the command statement to obtain the corresponding target attributes; match the target attributes with the register attributes to obtain the corresponding matching results; if the matching result is successful, determine that the command statement is supported for execution; if the matching result is failed, determine that the command statement is not supported for execution.
[0131] Optionally, the register attributes include a register type and a corresponding register address, and the statement judgment unit 200 is specifically used to: when the register access request is a read request, determine the corresponding target type and target address based on the target attribute; if the target type is the same as the register type, and the target address is the same as the register address, determine that the matching result between the target attribute and the register attribute is successful; if the target type is different from the register type, and / or the target address is different from the register address, determine that the matching result between the target attribute and the register attribute is failed.
[0132] Optionally, the register attributes include a register type and a corresponding register address and a numerical range. The statement judgment unit 200 is specifically used to: when the register access request is a write request, determine the corresponding target type, target address and target value based on the target attribute; if the target type is the same as the register type, the target address is the same as the register address, and the target value is within the numerical range, determine that the match result between the target attribute and the register attribute is successful; if the target type is different from the register type, and / or the target address is different from the register address, and / or the target value is not within the numerical range, determine that the match result between the target attribute and the register attribute is a failure.
[0133] Each unit shown above converts the register access request into the corresponding command statement through the register reading general CLI, and uses the register general CLI parsing layer to determine whether the command statement is supported for operation. When the command statement is supported for operation, the register adaptation layer is triggered to directly run the command statement to achieve direct access to the register adaptation layer, expose the register access problem in advance to the greatest extent to shorten the software development time, and provide developers with a more convenient and fast command-friendly way to directly access registers.
[0134] The present application also provides a computer-readable storage medium, which includes a stored program, wherein the program executes the register access method of the embedded system provided by the present application.
[0135] The present application also provides an electronic device, including: a processor, a memory and a bus. The processor and the memory are connected via a bus, the memory is used to store programs, and the processor is used to run programs, wherein the register access method of the embedded system provided by the present application is executed when the program is run.
[0136] In addition, the functions described above in the embodiments of the present application may be at least partially performed by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0137] Although several specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present application. Certain features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination.
[0138] The above description is only a preferred embodiment of the present application and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present application is not limited to the technical solution formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in this application (but not limited to) by each other to form a technical solution.
Claims
1. A register access method for an embedded system, characterized in that: include: Using the register read general CLI preset in the platform layer, the register access request input by the user is converted to obtain a command statement that can be recognized by the register adaptation layer; the register read general CLI includes conversion logic written based on the general language infrastructure; Using a register general CLI parsing layer preset in the driver layer, determining whether the command statement is supported for operation; the register general CLI parsing layer includes pre-configured register attributes; If the command statement is supported for execution, triggering the register adaptation layer to directly execute the command statement to implement access to the target register; The target register is the register indicated by the register access request; If the command statement cannot be supported for execution, a prompt message is sent to the user; the prompt message is used to remind the user that the target register access fails.
2. The method according to claim 1, characterized in that Using the register universal CLI parsing layer preset in the driver layer, judging whether the command statement is supported for operation includes: Parsing the command statement using a register universal CLI parsing layer preset in the driver layer to obtain corresponding target attributes; Matching the target attribute with the register attribute to obtain a corresponding matching result; If the matching result is successful, determining that the command statement is supported for execution; If the matching result is failure, it is determined that the command statement cannot be supported for execution.
3. The method according to claim 2, characterized in that The register attribute includes a register type and a corresponding register address, and the target attribute is matched with the register attribute to obtain a corresponding matching result, including: In the case where the register access request is a read request, determining a corresponding target type and a target address based on the target attribute; If the target type is the same as the register type, and the target address is the same as the register address, determining that the match result between the target attribute and the register attribute is successful; If the target type is different from the register type, and / or the target address is different from the register address, it is determined that the matching result between the target attribute and the register attribute is a failure.
4. The method according to claim 2, characterized in that: The register attribute includes a register type and a corresponding register address and a value range. The target attribute is matched with the register attribute to obtain a corresponding matching result, including: In the case where the register access request is a write request, determining a corresponding target type, a target address, and a target value based on the target attribute; If the target type is the same as the register type, the target address is the same as the register address, and the target value is within the numerical range, determining that the match result between the target attribute and the register attribute is successful; If the target type is different from the register type, and / or the target address is different from the register address, and / or the target value is not within the numerical range, it is determined that the matching result between the target attribute and the register attribute is a failure.
5. A register access device for an embedded system, characterized in that: include: A statement conversion unit, used to convert the register access request input by the user using the register reading general CLI preset in the platform layer to obtain a command statement that can be recognized by the register adaptation layer; the register reading general CLI includes a conversion logic written based on the general language infrastructure; A statement judgment unit, used to judge whether the command statement is supported for operation by using a register general CLI parsing layer preset in the driver layer; the register general CLI parsing layer includes pre-configured register attributes; A command execution unit, configured to trigger the register adaptation layer to directly execute the command statement if the command statement is supported for execution, so as to access the target register; The target register is the register indicated by the register access request; A failure reminder unit, used for sending a reminder message to the user if the command statement cannot be supported for operation; The prompt information is used to remind the target register that the access fails.
6. The device according to claim 5, characterized in that The sentence judgment unit is specifically used for: Parsing the command statement using a register universal CLI parsing layer preset in the driver layer to obtain corresponding target attributes; Matching the target attribute with the register attribute to obtain a corresponding matching result; If the matching result is successful, determining that the command statement is supported for execution; If the matching result is failure, it is determined that the command statement cannot be supported for execution.
7. The device according to claim 6, characterized in that The register attribute includes a register type and a corresponding register address, and the statement judgment unit is specifically used for: In the case where the register access request is a read request, determining a corresponding target type and a target address based on the target attribute; If the target type is the same as the register type, and the target address is the same as the register address, determining that the match result between the target attribute and the register attribute is successful; If the target type is different from the register type, and / or the target address is different from the register address, it is determined that the matching result between the target attribute and the register attribute is a failure.
8. The device according to claim 6, characterized in that The register attribute includes a register type and a corresponding register address and a value range. The statement judgment unit is specifically used for: In the case where the register access request is a write request, determining a corresponding target type, a target address, and a target value based on the target attribute; If the target type is the same as the register type, the target address is the same as the register address, and the target value is within the numerical range, determining that the match result between the target attribute and the register attribute is successful; If the target type is different from the register type, and / or the target address is different from the register address, and / or the target value is not within the numerical range, it is determined that the matching result between the target attribute and the register attribute is a failure.
9. A storage medium, characterized in that: The storage medium includes a stored program, wherein the program, when executed by a processor, executes the register access method for an embedded system according to any one of claims 1 to 4.
10. An electronic device, characterized in that: include: processor, memory, and bus; The processor is connected to the memory via the bus; The memory is used to store programs, and the processor is used to run programs, wherein the program, when run by the processor, executes the register access method of the embedded system according to any one of claims 1 to 4.