Interrupt signal processing method, system and device and medium
By turning off interrupt enable in the BMC chip and processing interrupt requests according to the interrupt control flag status, the problems of CPU resource consumption and inefficiency are solved, and higher resource utilization and flexible interrupt processing strategies are achieved.
Patent Information
- Application Number
- CN202411295340.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2024-12-06
AI Technical Summary
In the SoC in the BMC chip, the CPU needs to operate multiple times when processing interrupt requests, resulting in resource consumption and inefficiency, especially when processing other high-priority tasks, interrupt requests are suspended, affecting the CPU's resource utilization rate.
By turning off interrupt enable when the interrupt clearing condition is met and determining the processing strategy based on the status of the interrupt control flag bit, the suspended state of the interrupt request is directly cleared or maintained, frequent CPU intervention is avoided and resource utilization is improved.
This method saves CPU resources, improves resource utilization, and adapts to different system requirements and interrupt processing priorities, improving the efficiency and response speed of interrupt processing.
Smart Images

Figure CN119088736A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of signal processing, and in particular to a method, system, device and medium for processing an interrupt signal. Background Art
[0002] In the SoC (System on Chip) in the BMC (Baseboard Management Controller) chip, the GPIO (General Purpose Input / Output) interface can be used to detect the status of external devices and trigger interrupts. The GPIO module can generate interrupt requests based on the configured interrupt trigger conditions and send them to the CPU (Central Processing Unit). If the interrupt request has not been processed and the CPU is processing other higher priority tasks, these interrupt requests will be suspended.
[0003] If the external device that generates the interrupt needs to be reprogrammed, the CPU must perform multiple steps to clear the current interrupt request: turn off the interrupt enable, clear the interrupt status, reconfigure the relevant registers, and then re-enable the interrupt. This process involves multiple operations and status management, which consumes CPU resources and may reduce CPU resource utilization. Summary of the invention
[0004] The purpose of the present invention is to provide a method, system, device and medium for processing an interrupt signal, which avoids frequently involving the CPU to perform multi-step operations, thereby saving CPU resources and improving resource utilization, and can also adapt to different system requirements and interrupt processing priorities.
[0005] On the one hand, the present application provides a method for processing an interrupt signal, which is applied to a processor, and the processing method includes:
[0006] When the interrupt clearing condition is met, turn off the interrupt enable;
[0007] Acquire the current state of the interrupt control flag of the processor, where the state of the interrupt control flag is set according to the interrupt clearing requirement of the user;
[0008] Determine a strategy for processing an original interrupt request sent by an external device according to the current state, and process the original interrupt request according to the determined strategy; the external device is connected to the processor via a general purpose input and output interface;
[0009] The strategy is to directly clear the pending state of the original interrupt request, or to keep the interrupt enable turned off and wait for the processor to clear the pending state of the original interrupt request.
[0010] Wherein, determining a strategy for processing an original interrupt request sent by an external device according to the current state, and processing the original interrupt request according to the determined strategy, includes:
[0011] Determine whether the current state of the interrupt control flag is the first state;
[0012] If the interrupt control flag is in the first state, directly clearing the pending state of the original interrupt request sent by the external device;
[0013] If the interrupt control flag is not in the first state, the interrupt enable is kept turned off, and the processor is waited for clearing the pending state of the original interrupt request.
[0014] Among them, when the interrupt clearing condition is met, before the interrupt enable is turned off, it also includes:
[0015] Setting the interrupt control flag bit for the processor;
[0016] Obtaining the user's current interruption clearing requirement, wherein the interruption clearing requirement includes immediate clearing and normal request;
[0017] Setting the status bit of the interrupt control flag bit according to the interrupt clearing requirement;
[0018] When the interrupt clearing requirement is the immediate clearing, the interrupt control flag is in the first state; when the interrupt clearing requirement is the normal request, the interrupt control flag is in the second state.
[0019] Wherein, setting the interrupt control flag bit for the processor includes:
[0020] Configuring an interrupt control register for the processor;
[0021] Setting the status bit of the interrupt control flag bit according to the interrupt clearing requirement includes:
[0022] According to the interrupt clearing requirement, configuring the value of the interrupt control register;
[0023] When the interrupt clearing requirement is the immediate clearing requirement, the value of the interrupt control register is 1; when the interrupt clearing requirement is the normal request, the value of the interrupt control register is 0.
[0024] Among them, when the interrupt clearing condition is met, before the interrupt enable is turned off, it also includes:
[0025] Determining whether the processor needs to reconfigure interrupts, or determining whether the external device needs to reprogram interrupts;
[0026] If the processor needs to reconfigure the interrupt, or the external device needs to reconfigure the interrupt program, it is determined that the interrupt clearing condition is met.
[0027] Among them, when the interrupt clearing condition is met, before the interrupt enable is turned off, it also includes:
[0028] Configuring an interrupt trigger type of a general input / output interface connected to the external device;
[0029] Turning on the interrupt enable;
[0030] When receiving an original interrupt request sent by an external device, generating an interrupt signal, and sending the interrupt signal to the processor;
[0031] If the processor does not process the interrupt signal, suspending the interrupt signal corresponding to the original interrupt request to wait for processing by the processor;
[0032] After the interrupt signal is suspended, it is determined whether the processor or the external device meets an interrupt clearing condition.
[0033] Among them, when the interrupt clearing condition is met, the interrupt enable is turned off, including:
[0034] When the interrupt clearing condition is met, the value in the interrupt enable register is triggered to change from 1 to 0;
[0035] Obtaining the current state of the interrupt control flag of the processor, where the state of the interrupt control flag is set according to the interrupt clearing requirement of the user, including:
[0036] Obtaining a value of an interrupt control register, wherein the value of the interrupt control register is set according to a user's interrupt clearing requirement;
[0037] Determining a strategy for processing an original interrupt request sent by an external device according to the current state, and processing the original interrupt request according to the determined strategy; comprising:
[0038] If the value of the interrupt control register is 1, the value of the interrupt status register is triggered to become 0, and the interrupt signal is pulled low;
[0039] If the value of the interrupt control register is 0, the value of the interrupt status register is kept as 1, the interrupt signal is kept high, and the original interrupt request of the external device is continuously sent to the processor until the processor clears the pending state of the interrupt signal corresponding to the original interrupt request;
[0040] Wherein, in the process of keeping the interrupt signal high and continuously sending the original interrupt request of the external device to the processor, it also includes:
[0041] Start the timer to start timing;
[0042] Determining whether the processor clears the pending state of the interrupt signal corresponding to the original interrupt request within a preset time;
[0043] If not cleared, a clearing timeout signal is fed back to allow the user to determine whether to adjust the value of the interrupt control register based on the clearing timeout signal.
[0044] On the other hand, the present application provides an interrupt signal processing system, which is applied to a processor, and the processing method includes:
[0045] An enabling control unit, used to turn off interrupt enabling when an interrupt clearing condition is met;
[0046] A state acquisition unit, used to acquire the current state of the interrupt control flag of the processor, wherein the state of the interrupt control flag is set according to the interrupt clearing requirement of the user;
[0047] An interrupt processing unit, configured to determine a strategy for processing an original interrupt request sent by an external device according to the current state, and process the original interrupt request according to the determined strategy; the external device is connected to the processor via a general purpose input / output interface;
[0048] The processing method is to directly clear the pending state of the original interrupt request, or to keep the interrupt enable turned off and wait for the processor to clear the pending state of the original interrupt request.
[0049] On the other hand, the present application provides an interrupt signal processing device, comprising:
[0050] Memory for storing computer programs;
[0051] The processor is used to implement the steps of the interrupt signal processing method as described above when executing a computer program.
[0052] On the other hand, the present application provides a non-volatile storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the interrupt signal processing method as described above are implemented.
[0053] The present invention provides a method, system, device and medium for processing an interrupt signal, which relates to the field of signal processing and is used to solve the problems of CPU resource consumption and low efficiency. The solution allows the interrupt enable to be automatically turned off when specific conditions are met, and directly clears the suspended state of the original interrupt request sent by the external device according to the interrupt clearing requirements set by the user. This automated processing method avoids frequently involving the CPU to perform multiple steps, thereby saving CPU resources and improving resource utilization. In addition, the solution also provides flexibility. If necessary, it is also possible to choose to keep the interrupt enable turned off and wait for the processor to subsequently participate in clearing the suspended state of the interrupt request to adapt to different system requirements and interrupt processing priorities. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0055] Figure 1 A flowchart of a method for processing an interrupt signal provided by the present invention;
[0056] Figure 2 A specific implementation flow chart of a method for processing an interrupt signal provided by the present invention;
[0057] Figure 3 A flowchart of an implementation of a method for processing an interrupt signal provided by the present invention;
[0058] Figure 4 A flowchart of another implementation of a method for processing an interrupt signal provided by the present invention;
[0059] Figure 5 The present invention is a block diagram of an interrupt signal processing system provided by the present invention. DETAILED DESCRIPTION
[0060] The core of the present invention is to provide a method, system, device and medium for processing an interrupt signal, which avoids frequently involving the CPU to perform multi-step operations, thereby saving CPU resources and improving resource utilization, and can adapt to different system requirements and interrupt processing priorities.
[0061] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0062] On the one hand, if Figure 1 As shown, the present application provides a method for processing an interrupt signal, which is applied to a processor, and the processing method includes:
[0063] S11: When the interrupt clearing condition is met, turn off the interrupt enable;
[0064] In the interrupt signal processing method, this step involves the principle and implementation of turning off interrupt enable. Interrupt enable is usually an important function in a processor or controller, which allows the processor to receive and respond to interrupt requests from external devices. Turning off interrupt enable means temporarily prohibiting the processor from receiving new interrupt signals, which is necessary in certain circumstances, such as avoiding receiving other interrupts at the same time when processing the current interrupt request, resulting in resource competition or data loss.
[0065] Specifically, disabling interrupt enable can be accomplished by controlling the corresponding register or flag bit in the processor. Once the interrupt enable is disabled, the processor will no longer respond to new interrupt signals until the enable is enabled again. This operation is usually atomic, that is, during the period when the interrupt enable is disabled, the processor will not interrupt the currently executing instruction flow, thereby ensuring the stability and reliability of the system.
[0066] When the interrupt clearing condition is met, the interrupt enable is turned off to ensure that the processor can focus on clearing the pending state of the current interrupt request without being interrupted by other interrupts. This can effectively manage system resources, avoid resource competition and conflicts, and improve the efficiency and response speed of interrupt processing.
[0067] S12: obtaining the current state of the interrupt control flag of the processor, where the state of the interrupt control flag is set according to the interrupt clearing requirement of the user;
[0068] This step involves obtaining the current state of the processor's interrupt control flags, and these states are set according to the interrupt clearing requirements set by the user. In the interrupt processing process, the interrupt control flag plays a key role, which records the processor's current response status to each interrupt request and whether the processor needs to further process these interrupts.
[0069] Specifically, the interrupt control flag can be a specific bit or flag in one or more registers, which is used to indicate whether the processor currently has an interrupt waiting to be processed, whether the pending state of the interrupt request needs to be cleared, and whether a new interrupt request is allowed to be received. The status of these flags is usually controlled by the logic circuit or state machine inside the processor, and is updated and maintained according to the interrupt signal sent by the external device and the interrupt processing strategy preset by the user. In actual applications, users can configure these interrupt control flags according to the specific needs and priorities of the system.
[0070] S13: determining a strategy for processing the original interrupt request sent by the external device according to the current state, and processing the original interrupt request according to the determined strategy; the external device is connected to the processor through a general purpose input and output interface;
[0071] The strategy is to directly clear the pending state of the original interrupt request, or to keep the interrupt enable turned off and wait for the processor to clear the pending state of the original interrupt request.
[0072] This step involves determining how to handle the raw interrupt requests sent by external devices based on the current state, which are connected to the processor through the general input and output interface. Specifically, this step plays a key role in the interrupt handling process and determines how the processor responds to and handles different types of interrupt events.
[0073] First, based on the judgment of the interrupt clearing condition, the processor will determine how to handle the pending state of the received interrupt request according to the preset strategy and the interrupt clearing requirements set by the user. For example, when the interrupt clearing condition is met, the pending state of the interrupt request is automatically cleared immediately to ensure timely response and execution of the corresponding interrupt service program; or the interrupt enable is kept off and the processor is waiting for the processor to participate in clearing the pending state of the interrupt request again at an appropriate time.
[0074] This step emphasizes the flexibility and intelligence in the interrupt handling process. The processor dynamically adjusts the interrupt handling strategy according to the actual situation, thereby optimizing the system's responsiveness and resource utilization.
[0075] In summary, the present application provides a method for processing an interrupt signal, which allows the interrupt enable to be automatically turned off when specific conditions are met, and directly clears the suspended state of the original interrupt request sent by the external device according to the interrupt clearing requirements set by the user. This automated processing method avoids frequently intervening the CPU to perform multiple steps, thereby saving CPU resources and improving resource utilization. In addition, the method also provides flexibility. If necessary, you can also choose to keep the interrupt enable turned off and wait for the processor to subsequently participate in clearing the suspended state of the interrupt request to adapt to different system requirements and interrupt processing priorities. Therefore, this interrupt signal processing method effectively solves the challenges of CPU resource management and interrupt processing efficiency in the background technology.
[0076] In one embodiment, a strategy for processing an original interrupt request sent by an external device is determined based on a current state, and the original interrupt request is processed based on the determined strategy, including: determining whether the current state of an interrupt control flag is a first state; if the interrupt control flag is the first state, directly clearing the pending state of the original interrupt request sent by the external device; if the interrupt control flag is not the first state, keeping the interrupt enable turned off, and waiting for the processor to clear the pending state of the original interrupt request.
[0077] In this embodiment, after obtaining the current state of the interrupt control flag of the processor, further steps involve judging the interrupt control flag and taking different processing strategies according to the judgment result. First, the processor obtains the current state of the interrupt control flag, which is usually determined by the previous interrupt processing or user setting, and is used to reflect whether a new interrupt request needs to be processed immediately.
[0078] In the next step, the processor first determines whether the interrupt control flag is in the defined first state. If the interrupt control flag is indeed in the first state, the processor will choose to directly clear the pending state of the original interrupt request sent by the external device. This means that the processor clears and confirms the received interrupt request through a specific mechanism or instruction, and then continues to execute subsequent interrupt service routines or other tasks. On the contrary, if the interrupt control flag is not in the first state, the processor will keep the interrupt enable turned off and wait for the processor to participate in clearing the pending state of the original interrupt request. In this case, the processor may need to perform some additional operations or wait for conditions to be met, such as waiting for a specific state transition or receiving a completion signal of other processing tasks, and then reconsider whether to clear the pending state.
[0079] Overall, this method effectively manages and optimizes the interrupt processing process through dynamic interrupt control flag status judgment and flexible processing strategy. It not only improves the system's response speed and accuracy to interrupt events, but also ensures the effective use of system resources and system stability, especially in high-load or complex application scenarios, showing significant advantages and flexibility.
[0080] In one embodiment, when the interrupt clearing condition is met, before disabling the interrupt enable, the method further includes:
[0081] Set the interrupt control flag for the processor;
[0082] Obtain the user's current interruption clearing requirements, which include immediate clearing and normal requests;
[0083] Set the status bit of the interrupt control flag bit according to the interrupt clearing requirement;
[0084] When the interrupt clearing requirement is immediate clearing, the interrupt control flag is in the first state; when the interrupt clearing requirement is a normal request, the interrupt control flag is in the second state.
[0085] In this embodiment, the processor needs to perform several key steps before the interrupt clearing condition is met. First, the processor sets an interrupt control flag for itself, which is used to manage and record the status and requirements of the current interrupt processing. Such a flag is usually a specific register or memory location used to store and update related status information.
[0086] Next, the processor obtains the user's current interrupt clearing requirements. These requirements are generally divided into two types: immediate clearing and normal requests. Immediate clearing means that the processor must respond to and clear the received interrupt request as soon as possible, and the interrupt control flag will be set to the "first state". Normal requests mean that the interrupt request can be processed later, and the processor will set the appropriate state as needed, and the interrupt control flag will be set to the "second state".
[0087] According to the specific interrupt clearing requirements, the processor will set the status of the interrupt control flag bit accordingly. This setting ensures that the processor can carry out subsequent interrupt processing in an orderly manner according to the priority or clearing policy set by the user when receiving an interrupt request. In this way, the system can flexibly adjust the order and priority of interrupt processing, thereby optimizing the system's resource utilization and response speed, and ensuring that the processor can effectively manage and handle various interrupt events in complex interrupt scenarios.
[0088] In one embodiment, setting an interrupt control flag bit for a processor includes:
[0089] Configure interrupt control registers for the processor;
[0090] Set the status bit of the interrupt control flag according to the interrupt clearing requirements, including:
[0091] Configure the value of the interrupt control register according to the interrupt clearing requirements;
[0092] Among them, when the interrupt clearing requirement is immediate clearing, the value of the interrupt control register is 1; when the interrupt clearing requirement is a normal request, the value of the interrupt control register is 0.
[0093] In a specific embodiment, setting the interrupt control flag for the processor is a key step for effectively managing and processing interrupt requests. First, this process involves configuring the interrupt control register inside the processor. The interrupt control register is a special register in the processor or system that is used to store status and control information related to interrupt processing. Before configuring the interrupt control register, the processor will first obtain the interrupt clearing requirement. These requirements may vary depending on the specific application and system settings, and generally include two basic types: immediate clearing and normal request. Based on the obtained interrupt clearing requirement, the processor will set the value of the interrupt control register accordingly. This setting is generally implemented by writing a specific binary bit, such as setting it to 0 or 1, to indicate different interrupt processing states (specifically, when the interrupt clearing requirement is immediate clearing, the value of the interrupt control register is 1; when the interrupt clearing requirement is normal request, the value of the interrupt control register is 1). By correctly configuring the interrupt control register, the processor can clearly know how to handle the received interrupt request, thereby ensuring the stability and reliability of the system under various interrupt conditions.
[0094] In one embodiment, when the interrupt clearing condition is met, before disabling the interrupt enable, the method further includes:
[0095] Determine whether the processor needs to reconfigure interrupts, or determine whether the external device needs to reprogram interrupts;
[0096] If the processor needs to reconfigure the interrupt, or the external device needs to reconfigure the interrupt program, it is determined that the interrupt clearing condition is met.
[0097] Specifically, this embodiment aims to describe a specific method for determining whether the interrupt clearing condition is met. That is, before the interrupt clearing condition is met and the interrupt enable is ready to be turned off, it is determined whether the processor needs to reconfigure the interrupt, or whether the external device needs to rewrite the interrupt program. The purpose of this step is to ensure that during the entire process of interrupt processing, necessary adjustments and configurations can be made as needed to ensure the correct processing of the interrupt and the stable operation of the system.
[0098] Specifically, situations in which the processor may need to reconfigure interrupts include but are not limited to the following: 1. If other higher priority interrupt requests occur in the system, it may be necessary to re-evaluate the current interrupt priority setting and adjust the order or strategy of interrupt processing; 2. If the status of an external device changes, such as a hardware configuration change or a device fault repair, it may be necessary to update the interrupt handler or reconfigure the interrupt control register accordingly; 3. If the strategy or configuration during system operation changes, it may be necessary to readjust the relevant settings of interrupt processing to meet new system requirements or safety standards.
[0099] In summary, judging whether the interrupt needs to be reconfigured or whether the external device needs to rewrite the interrupt program is to ensure flexibility and adaptability in the interrupt processing process. This judgment process is performed before the interrupt clearing condition is met, so that the system can make necessary adjustments before turning off the interrupt enable, thereby effectively handling and managing interrupt events and improving the system's response speed and overall reliability.
[0100] In one embodiment, when the interrupt clearing condition is met, before disabling the interrupt enable, the method further includes:
[0101] Configure the interrupt trigger type of the general input and output interface connected to the external device;
[0102] Turn on interrupt enable;
[0103] When receiving the original interrupt request sent by the external device, an interrupt signal is generated and sent to the processor;
[0104] If the processor does not process the interrupt signal, the interrupt signal corresponding to the original interrupt request is suspended to wait for the processor to process it;
[0105] After the interrupt signal is suspended, determine whether the processor or external device meets the interrupt clearing condition.
[0106] Furthermore, the process of processing interrupt signals involves multiple key steps. First, the interrupt trigger type of the general input and output interface connected to the external device is configured according to the requirements, which is to ensure that the system can correctly respond to the interrupt request sent by the external device. After the configuration is completed, the interrupt enable is turned on so that the interrupt signal from the external device can be captured and processed in time. When the external device sends an original interrupt request, the corresponding interrupt signal will be generated immediately and sent to the processor. If the processor is currently processing other tasks with higher priority, or fails to process the interrupt signal in time due to other reasons, the interrupt signal corresponding to the original interrupt request will be temporarily suspended. Suspension means that the system temporarily stops processing the interrupt signal until the processor can effectively process or clear the interrupt request. After the interrupt signal is suspended, it will immediately determine whether the processor or external device meets the preset interrupt clearing conditions. These conditions may include whether the processor needs to reconfigure the interrupt, whether the external device needs to rewrite the interrupt program, etc. If the interrupt clearing conditions are met, corresponding measures will be taken, usually including turning off the interrupt enable to prevent further interrupt signals from interfering with the normal operation of the system. This process ensures that the system can efficiently respond to and manage interrupt events, ensuring the stability and reliability of the system. In one embodiment, when the interrupt clearing condition is met, disabling the interrupt enable includes:
[0107] When the interrupt clearing condition is met, the value in the trigger interrupt enable register changes from 1 to 0;
[0108] Get the current state of the processor's interrupt control flag. The state of the interrupt control flag is set according to the user's interrupt clearing requirements, including:
[0109] Get the value of the interrupt control register, which is set according to the user's interrupt clearing requirements;
[0110] Determine a strategy for processing an original interrupt request sent by an external device according to a current state, and process the original interrupt request according to the determined strategy; including:
[0111] If the value of the interrupt control register is 1, the value of the interrupt status register is triggered to become 0, and the interrupt signal is pulled low;
[0112] If the value of the interrupt control register is 0, the value of the interrupt status register is kept at 1, the interrupt signal is kept high, and the original interrupt request of the external device is continuously sent to the processor until the processor clears the pending state of the interrupt signal corresponding to the original interrupt request.
[0113] In the above embodiment, when the interrupt clearing condition is met, the process of executing the interrupt enable shutdown includes several key steps. First, the value in the interrupt enable register is triggered to change from 1 to 0, which means that the system stops accepting new interrupt requests. Next, the current state of the interrupt control flag of the processor is obtained. This state is set according to the interrupt clearing requirement set by the user and may affect the subsequent processing strategy. According to the current state obtained, it is determined how to handle the original interrupt request sent by the external device that has occurred. If the value of the interrupt control register is 1, it indicates that the user requires the interrupt to be cleared immediately, which triggers the value of the interrupt status register to become 0, and pulls down the interrupt signal, thereby notifying the external device that the interrupt has been processed. This process ensures timely response and clearing of the interrupt signal, preventing the interrupt request from continuing to be transmitted. On the other hand, if the value of the interrupt control register is 0, the value of the interrupt status register is kept at 1, the interrupt signal is kept at a high level, and the original interrupt request of the external device is continuously sent to the processor. In this case, the processor will wait for the suspended state of the interrupt signal corresponding to the original interrupt request to be cleared until the processor completes the processing.
[0114] This processing ensures that even when the interrupt enable is turned off, interrupt requests can still be effectively maintained and managed to ensure that all events are properly handled, thereby maintaining the stable operation state and responsiveness of the system.
[0115] In one embodiment, the process of keeping the interrupt signal high and continuously sending the original interrupt request of the external device to the processor also includes:
[0116] Start the timer to start timing;
[0117] and determining whether the processor clears the pending state of the interrupt signal corresponding to the original interrupt request within a preset time;
[0118] If not cleared, a clearing timeout signal is fed back to allow the user to determine whether to adjust the value of the interrupt control register based on the clearing timeout signal.
[0119] like Figure 2 , S21: configure the interrupt trigger type, turn on the interrupt enable, trigger the interrupt sensitivity type, and generate an interrupt; (where the int_cfg register is the interrupt control register); S22: meet the interrupt clearing condition (such as the processor turns off the interrupt enable or changes the interrupt sensitivity type); S23: select whether to retain the interrupt based on the value of int_cfg (where int_cfg is the value of the interrupt control register); if int_cfg=1, execute S24: the interrupt status is automatically cleared; if int_cfg=0, execute S25: the interrupt status is maintained and waits for the processor to clear; S26: the processor turns on the interrupt enable, and the new interrupt configuration takes effect.
[0120] Specifically, a situation such as Figure 3 , S31: The processor configures the general input and output port to input mode through the bus, and the int_cfg register is 1 (where the int_cfg register is the interrupt control register); S32: Configure the interrupt trigger type to be a rising edge interrupt, and turn on the interrupt enable; S33: The external device triggers an interrupt and makes an original interrupt request to the processor; S34: The external device needs to change the configuration, and the processor turns off the interrupt enable; S35: The interrupt status is automatically cleared; S36: The processor turns on the interrupt enable, and the new interrupt configuration takes effect.
[0121] Specifically, another situation such as Figure 4 , S41: The processor configures the general input and output port to input mode through the bus and the int_cfg register to 0; S42: Configure the interrupt trigger type to a rising edge interrupt and turn on the interrupt enable; S43: The external device triggers an interrupt and makes an original interrupt request to the processor; S44: The external device needs to change the configuration, and the processor turns off the interrupt enable; S45: The interrupt status is maintained, waiting for the processor to clear the interrupt; S46: The processor turns on the interrupt enable, and the new interrupt configuration takes effect.
[0122] In the above embodiment, when the system keeps the interrupt signal in a high level state and continues to send the original interrupt request of the external device to the processor, the following key steps are also involved. First, a timer is started and timing begins. The function of this timer is to monitor whether the processor can clear the suspended state of the interrupt signal corresponding to the original interrupt request in time within a preset time. During the timing of the timer, the response of the processor will be continuously detected. If the processor fails to successfully clear the suspended state of the interrupt signal corresponding to the original interrupt request within the preset time, a clear timeout signal will be generated. The generation of this clear timeout signal is to provide feedback to the user, so that the user can decide whether to adjust the value of the interrupt control register or take other processing measures based on this signal.
[0123] By introducing a timer and clearing a timeout signal mechanism, the system not only maintains efficiency and timeliness when processing interrupt requests, but also adds a monitoring and feedback mechanism for the processor's responsiveness. This design can effectively optimize the system's management and processing of interrupt events, ensuring that the system can maintain a stable and reliable operating state in a complex and changing environment.
[0124] Furthermore, after determining the strategy for processing the original interrupt request sent by the external device according to the current state, the method further includes generating an interrupt log.
[0125] Specifically, the specific steps of generating logs mainly include the following key links. First, in the process of executing interrupt signal processing, every important event and action will be recorded, such as the closing of interrupt enable, the change of state of interrupt status register, and the response of processor to interrupt request. Secondly, the moment when the interrupt clearing condition is met will be captured and recorded, which usually involves the setting of interrupt control flag bit and the change of interrupt enable state. Then, the specific details of each interrupt request will be recorded, including the information of external device where the interrupt occurs, the triggering condition of the interrupt, and any changes or feedback during the processor processing. The key is that any abnormal situation or error will also be recorded, such as the situation that the interrupt request is not cleared in time due to timeout, and the system's response strategy to such abnormal events. Finally, the generated log will include detailed information such as timestamp, event description, status of relevant registers and flag bits, so as to facilitate subsequent system analysis and troubleshooting. Through detailed and accurate logging, the system can provide managers and engineers with key operating status and event history, so as to help them better understand the operating status of the system, find problems in time and take necessary repair measures to ensure the stability and reliability of the system.
[0126] On the other hand, Figure 5 As shown, the present application provides an interrupt signal processing system, which is applied to a processor, and the processing method includes:
[0127] An enabling control unit 51, used to disable interrupt enabling when an interrupt clearing condition is met;
[0128] A state acquisition unit 52 is used to acquire the current state of the interrupt control flag of the processor, and the state of the interrupt control flag is set according to the interrupt clearing requirement of the user;
[0129] The interrupt processing unit 53 is used to determine a strategy for processing the original interrupt request sent by the external device according to the current state, and process the original interrupt request according to the determined strategy; the external device is connected to the processor through the general input and output interface;
[0130] The strategy is to directly clear the pending state of the original interrupt request, or to keep the interrupt enable turned off and wait for the processor to clear the pending state of the original interrupt request.
[0131] In one embodiment, the interrupt processing unit 53 is specifically used to determine whether the current state of the interrupt control flag is the first state; if the interrupt control flag is the first state, the pending state of the original interrupt request sent by the external device is directly cleared; if the interrupt control flag is not the first state, the interrupt enable is kept turned off, and the processor is waited for to clear the pending state of the original interrupt request.
[0132] In one embodiment, it also includes:
[0133] The interrupt control flag setting unit is used to set the interrupt control flag for the processor before turning off the interrupt enable when the interrupt clearing condition is met; obtain the user's current interrupt clearing requirement, which includes immediate clearing and normal request; set the status bit of the interrupt control flag according to the interrupt clearing requirement; when the interrupt clearing requirement is immediate clearing, the interrupt control flag is in the first state; when the interrupt clearing requirement is a normal request, the interrupt control flag is in the second state.
[0134] Among them, the interrupt control flag setting unit is specifically used to configure the interrupt control register for the processor; configure the value of the interrupt control register according to the interrupt clearing requirement, wherein when the interrupt clearing requirement is immediate clearing, the value of the interrupt control register is 1; when the interrupt clearing requirement is a normal request, the value of the interrupt control register is 0.
[0135] In one embodiment, it also includes:
[0136] The interrupt clearing judgment unit is used to judge whether the processor needs to reconfigure the interrupt or whether the external device needs to rewrite the interrupt program before turning off the interrupt enable when the interrupt clearing condition is met; if the processor needs to reconfigure the interrupt or the external device needs to reconfigure the interrupt program, it is determined that the interrupt clearing condition is met.
[0137] In one embodiment, it also includes:
[0138] The interrupt trigger type configuration unit is used to configure the interrupt trigger type of the general input and output interface connected to the external device before turning off the interrupt enable when the interrupt clearing condition is met; turn on the interrupt enable; when receiving the original interrupt request sent by the external device, generate an interrupt signal and send the interrupt signal to the processor; if the processor does not process the interrupt signal, suspend the interrupt signal corresponding to the original interrupt request to wait for the processor to process it; after the interrupt signal is suspended, determine whether the processor or the external device meets the interrupt clearing condition.
[0139] In one embodiment, the enabling control unit 51 is specifically configured to trigger the value in the interrupt enabling register to be changed from 1 to 0 when the interrupt clearing condition is met;
[0140] A state acquisition unit 52 is used to acquire the value of an interrupt control register, and the value of the interrupt control register is set according to the interrupt clearing requirement of the user;
[0141] The interrupt processing unit 53 is specifically used to trigger the value of the interrupt status register to become 0 and pull down the interrupt signal if the value of the interrupt control register is 1; if the value of the interrupt control register is 0, keep the value of the interrupt status register at 1, keep the interrupt signal high, and continue to send the original interrupt request of the external device to the processor until the processor clears the suspended state of the interrupt signal corresponding to the original interrupt request.
[0142] In one embodiment, it also includes:
[0143] The timing unit is used to start the timer to start timing while keeping the interrupt signal high and continuously sending the original interrupt request of the external device to the processor; and to determine whether the processor clears the suspended state of the interrupt signal corresponding to the original interrupt request within a preset time; if not cleared, a clear timeout signal is fed back to enable the user to determine whether to adjust the value of the interrupt control register based on the clear timeout signal.
[0144] For an introduction to the interrupt signal processing system, please refer to the above-mentioned embodiment, and this application will not go into details here.
[0145] On the other hand, the present application provides an interrupt signal processing device, comprising:
[0146] Memory for storing computer programs;
[0147] The processor is used to implement the steps of the interrupt signal processing method as described above when executing a computer program. For the introduction of the interrupt signal processing device, please refer to the above embodiment, and this application will not repeat it here.
[0148] On the other hand, the present application provides a non-volatile storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the interrupt signal processing method described above are implemented. For the introduction of the non-volatile storage medium, please refer to the above embodiment, and the present application will not repeat it here.
[0149] On the other hand, the present application provides a computer program product, including a computer program / instruction, which implements the steps of the interrupt signal processing method as described above when the computer program / instruction is executed by a processor. For the introduction of the computer program product, please refer to the above embodiment, and the present application will not repeat it here.
[0150] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used 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. Moreover, the terms "comprise", "include" 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 further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0151] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for processing an interrupt signal, characterized in that: Applied to a processor, the processing method includes: When the interrupt clearing condition is met, turn off the interrupt enable; Acquire the current state of the interrupt control flag of the processor, where the state of the interrupt control flag is set according to the interrupt clearing requirement of the user; Determine a strategy for processing an original interrupt request sent by an external device according to the current state, and process the original interrupt request according to the determined strategy; the external device is connected to the processor via a general purpose input and output interface; The strategy is to directly clear the pending state of the original interrupt request, or to keep the interrupt enable turned off and wait for the processor to clear the pending state of the original interrupt request.
2. The method for processing an interrupt signal according to claim 1, wherein: Determining a strategy for processing an original interrupt request sent by an external device according to the current state, and processing the original interrupt request according to the determined strategy, including: Determine whether the current state of the interrupt control flag is the first state; If the interrupt control flag is in the first state, directly clearing the pending state of the original interrupt request sent by the external device; If the interrupt control flag is not in the first state, the interrupt enable is kept turned off, and the processor is waited for clearing the pending state of the original interrupt request.
3. The method for processing an interrupt signal according to claim 2, wherein: When the interrupt clearing condition is met, before the interrupt enable is turned off, it also includes: Setting the interrupt control flag bit for the processor; Obtaining the user's current interruption clearing requirement, wherein the interruption clearing requirement includes immediate clearing and normal request; Setting the status bit of the interrupt control flag bit according to the interrupt clearing requirement; When the interrupt clearing requirement is the immediate clearing, the interrupt control flag is in the first state; when the interrupt clearing requirement is the normal request, the interrupt control flag is in the second state.
4. The method for processing an interrupt signal according to claim 3, characterized in that: Setting the interrupt control flag bit for the processor includes: Configuring an interrupt control register for the processor; Setting the status bit of the interrupt control flag bit according to the interrupt clearing requirement includes: According to the interrupt clearing requirement, configuring the value of the interrupt control register; When the interrupt clearing requirement is the immediate clearing requirement, the value of the interrupt control register is 1; when the interrupt clearing requirement is the normal request, the value of the interrupt control register is 0.
5. The method for processing an interrupt signal according to claim 1, wherein: When the interrupt clearing condition is met, before the interrupt enable is turned off, it also includes: Determining whether the processor needs to reconfigure interrupts, or determining whether the external device needs to reprogram interrupts; If the processor needs to reconfigure the interrupt, or the external device needs to reconfigure the interrupt program, it is determined that the interrupt clearing condition is met.
6. The method for processing an interrupt signal according to claim 1, wherein: When the interrupt clearing condition is met, before the interrupt enable is turned off, it also includes: Configuring an interrupt trigger type of a general input / output interface connected to the external device; Turning on the interrupt enable; When receiving an original interrupt request sent by an external device, generating an interrupt signal, and sending the interrupt signal to the processor; If the processor does not process the interrupt signal, suspending the interrupt signal corresponding to the original interrupt request to wait for processing by the processor; After the interrupt signal is suspended, it is determined whether the processor or the external device meets an interrupt clearing condition.
7. The method for processing an interrupt signal according to any one of claims 1 to 6, characterized in that: When the interrupt clearing conditions are met, turn off the interrupt enable, including: When the interrupt clearing condition is met, the value in the interrupt enable register is triggered to change from 1 to 0; Obtaining the current state of the interrupt control flag of the processor, where the state of the interrupt control flag is set according to the interrupt clearing requirement of the user, including: Obtaining a value of an interrupt control register, wherein the value of the interrupt control register is set according to a user's interrupt clearing requirement; Determining a strategy for processing an original interrupt request sent by an external device according to the current state, and processing the original interrupt request according to the determined strategy, including: If the value of the interrupt control register is 1, the value of the interrupt status register is triggered to become 0, and the interrupt signal is pulled low; If the value of the interrupt control register is 0, the value of the interrupt status register is kept as 1, the interrupt signal is kept high, and the original interrupt request of the external device is continuously sent to the processor until the processor clears the pending state of the interrupt signal corresponding to the original interrupt request; Wherein, in the process of keeping the interrupt signal high and continuously sending the original interrupt request of the external device to the processor, it also includes: Start the timer to start timing; Determining whether the processor clears the pending state of the interrupt signal corresponding to the original interrupt request within a preset time; If not cleared, a clearing timeout signal is fed back to allow the user to determine whether to adjust the value of the interrupt control register based on the clearing timeout signal.
8. A system for processing an interrupt signal, characterized in that: Applied to a processor, the processing method includes: An enabling control unit, used to turn off interrupt enabling when an interrupt clearing condition is met; A state acquisition unit, used to acquire the current state of the interrupt control flag of the processor, wherein the state of the interrupt control flag is set according to the interrupt clearing requirement of the user; An interrupt processing unit, configured to determine a strategy for processing an original interrupt request sent by an external device according to the current state, and process the original interrupt request according to the determined strategy; the external device is connected to the processor via a general purpose input / output interface; The strategy is to directly clear the pending state of the original interrupt request, or to keep the interrupt enable turned off and wait for the processor to clear the pending state of the original interrupt request.
9. A device for processing an interrupt signal, characterized in that: include: Memory for storing computer programs; A processor, used to implement the steps of the interrupt signal processing method as described in any one of claims 1 to 7 when executing a computer program.
10. A non-volatile storage medium, characterized in that: The non-volatile storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for processing an interrupt signal according to any one of claims 1 to 7 are implemented.
