CIRCUITRY SYSTEM AND METHOD FOR PROCESSING INTERRUPT PRIORITY
20200026671 ยท 2020-01-23
Inventors
Cpc classification
G06F2213/2412
PHYSICS
International classification
Abstract
The disclosure is related to a circuitry system and a method for processing interrupt priority. The circuitry system is such as a system-on-chip that operates the method. The high-priority interrupt is configured to be always on and prohibited from accessing a critical section. When a high-priority interrupt occurs as a processor of the system is in operation, the processor sets a low-priority interrupt to access the critical section where the high-priority interrupt accessed previously. When the low-priority interrupt is terminated, the processor determines whether or not to wake up the unfinished task that is previously set for the high-priority interrupt. The processor continues processing the task since the task has not been finished. The circuity system can therefore retain the characteristics of all disabled interrupts and also maintain an instantaneity for the important tasks of the system.
Claims
1. A circuitry system, comprising: a processor and one or more subsystems, wherein the processor is used to perform a method for processing interrupt priority, in which a high-priority interrupt applied to the processor is set as an always-on interrupt for processing any instant task.
2. The system as recited in claim 1, wherein the method for processing interrupt priority performed by the processor of the circuitry system further comprises: receiving a high-priority interrupt by the processor for accessing a critical section when the processor performs a task; setting a low-priority interrupt for the processor to access and process data in the critical section where the high-priority interrupt is applied for the processor to access; the processor determining whether or not to wake up the task which is not finished under the high-priority interrupt when returning the low-priority interrupt; and the processor continuing processing the unfinished task under the high-priority interrupt.
3. The system as recited in claim 2, wherein the circuitry system is a System-On-Chip.
4. The system as recited in claim 2, wherein the one or more subsystems issues the high-priority interrupt or the low-priority interrupt to the processor.
5. The system as recited in claim 2, wherein the circuitry system is operated in a computer system, and the method for processing interrupt priority is operated to a real-time operating system.
6. The system as recited in claim 2, wherein the original task performed by the processor is a task without an interrupt.
7. The system as recited in claim 2, wherein the original task performed by the processor is a task with the low-priority interrupt.
8. The system as recited in claim 2, further comprising a preceding procedure that sets the high-priority interrupt to be the always-on interrupt, and a processing function of the priority interrupt is prohibited to access the critical section.
9. The system as recited in claim 8, wherein a processing function of the low-priority interrupt is configured to allow accessing the critical section.
10. The system as recited in claim 9, wherein the step for setting the low-priority interrupt is to set a flag state or a bit state for notifying the low-priority interrupt.
11. A method for processing interrupt priority, comprising: receiving a high-priority interrupt by a processor for accessing a critical section when the processor performs a task, wherein the processor sets the high-priority interrupt as an always-on interrupt for processing any instant task; setting a low-priority interrupt for the processor to access and process data in the critical section where the high-priority interrupt is applied for the processor to access; the processor determining whether or not to wake up the task which is not finished under the high-priority interrupt when returning the low-priority interrupt; and the processor continuing processing the unfinished task previously set for the high-priority interrupt if the task is woken up.
12. The method as recited in claim 11, wherein the method is applied to a circuitry system that includes the processor and one or more subsystems.
13. The method as recited in claim 12, wherein the one or more subsystems issues the high-priority interrupt or the low-priority interrupt to the processor.
14. The method as recited in claim 11, wherein the circuitry system is operated in a computer system, and the method for processing interrupt priority is operated to a real-time operating system.
15. The method as recited in claim 14, wherein the original task performed by the processor is a task without an interrupt.
16. The method as recited in claim 14, wherein the original task performed by the processor is a task with the low-priority interrupt.
17. The method as recited in claim 16, wherein the step for setting the low-priority interrupt is to set a flag state or a bit state for notifying the low-priority interrupt.
18. The method as recited in claim 11, further comprising a preceding procedure that sets the high-priority interrupt to be the always-on interrupt, and a processing function of the priority interrupt is prohibited to access the critical section.
19. The method as recited in claim 18, wherein a processing function of the low-priority interrupt is configured to allow accessing the critical section.
20. The method as recited in claim 19, wherein the step for setting the low-priority interrupt is to set a flag state or a bit state for notifying the low-priority interrupt.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The present disclosure will become more fully understood from the following detailed description and accompanying drawings.
[0018]
[0019]
[0020]
[0021]
DETAILED DESCRIPTION OF THE EXEMPLARY EMBODIMENTS
[0022] The present disclosure is more particularly described in the following examples that are intended as illustrative only since numerous modifications and variations therein will be apparent to those skilled in the art. Like numbers in the drawings indicate like components throughout the views. As used in the description herein and throughout the claims that follow, unless the context clearly dictates otherwise, the meaning of a, an, and the includes plural reference, and the meaning of in includes in and on. Titles or subtitles can be used herein for the convenience of a reader, which shall have no influence on the scope of the present disclosure.
[0023] The terms used herein generally have their ordinary meanings in the art. In the case of conflict, the present document, including any definitions given herein, will prevail. The same thing can be expressed in more than one way. Alternative language and synonyms can be used for any term(s) discussed herein, and no special significance is to be placed upon whether a term is elaborated or discussed herein. A recital of one or more synonyms does not exclude the use of other synonyms. The use of examples anywhere in this specification including examples of any terms is illustrative only, and in no way limits the scope and meaning of the present disclosure or of any exemplified term. Likewise, the present disclosure is not limited to various embodiments given herein. Numbering terms such as first, second or third can be used to describe various components, signals or the like, which are for distinguishing one component/signal from another one only, and are not intended to, nor should be construed to impose any substantive limitations on the components, signals or the like.
[0024] The disclosure is related to a method for processing interrupt priority and a circuitry system. One of the objectives of the method is to utilize characteristics of interrupt priority applied to a SoC (System-On-Chip) that uses a disabled interrupt to implement a critical section, which on the other hand makes a high-priority interrupt applied to a CPU always on. For example, the tasks such as the computer procedure relating to security, emergency treatment or important threads, performed by the CPU under the high-priority interrupt may not be affected by another interrupt. Therefore, the high-priority interrupt will be set always-on in this aspect for keeping the system's instantaneity for the important tasks.
[0025] The interrupt priority denotes an interrupt state that is a high-priority interrupt or a low-priority interrupt. The interrupt state is written to a register of an interrupt controller, or managed by a software program.
[0026] However, it is necessary for the central processing unit (CPU) of the system to set the high-priority interrupt as an always-on state in the computer procedure even if the interrupt still administrates how the subsystem uses the system resources. For example, to maintain the instantaneity of the system's process, the high-priority interrupt for the system may be necessary to be always-on for processing the procedure concerning security or the procedure requiring instant response when the SoC is applied to a Real-Time Operating System (RTOS).
[0027] Most RTOSs use disabled interrupt to embody the critical section. The critical section refers to a code segment that can be accessed by interrupts and the kernel, e.g. the inner threads, at the same time, for example when a user accesses data in the critical section via a SoC so as to form a thread in the CPU for executing a code of the critical section. The data received by the threads may be inconsistent or erroneous due to the data in the critical section not being able to be accessed by threads of the subsystems at the same time. Therefore, the disabled interrupt approach is generally used to prohibit other threads from accessing the critical section. The only drawback of the approach is that the disabled interrupt turns off the low-priority interrupt and also makes the high-priority interrupt to be masked. Thus, the high-priority interrupt may fail to get the instant processing and so there will be some loss in instantaneity.
[0028] According to one embodiment of the circuitry system for processing the interrupt priority of the disclosure, the disabled interrupt approach that masks the low-priority interrupt is used to implement the critical section. The critical section allows the real-time operating system not to affect the original process and effectively enhance the instantaneity of the real-time operating system.
[0029] The abovementioned SoC includes a processor and one or more subsystems. The processor performs the method for processing interrupt priority. An internal interrupt controller of the processor or an external interrupt controller outside the system is responsible for processing the interrupt signals triggered by each of the subsystems. It should be noted that the subsystem is such as a module of the SoC. Each of the subsystems launches a request and sends it to the processor by the interrupt controller. The processor can orderly arrange the interrupt services according to a priority order. When one of the subsystems triggers an interrupt, the interrupt controller is in charge of communicating with other subsystems. A corresponding interrupt signal and an interrupt request are transmitted to the processor in the meantime. The interrupt controller forwards the interrupt request to the processor when receiving the interrupt signal. The interrupt controller accordingly performs a handling program.
[0030] In an exemplary example, the processor of SoC supports 16 interrupts, in which number 0 to 7 of the interrupts are classified into low-priority interrupts with the same priority order, and can only be interrupted by the high-priority interrupt; number 8 to 15 of the interrupts are the high-priority interrupts that have the same interrupt.
[0031] In the present embodiment, a rule for processing the interrupt service routine is provided. In the rule, the conventional disabled interrupt approach is modified as masking the low-priority interrupt, and the enabled interrupt approach is replaced by the approach for unmasking the low-priority interrupt. Further, the high-priority interrupt is set as always on according to the rule. A processing function of the low-priority interrupt is allowed to access the critical section. The high-priority interrupt can be applied to handle any instant task when it is set as always on. However, the processing function of the high-priority interrupt is prohibited to access the critical section. The high-priority interrupt accomplishes message delivery by communicating with the low-priority interrupt. For example, an interrupt flag is incorporated for the communication so as to wake up the task when returning the low-priority interrupt and continue processing the unfinished task previously set for the high-priority interrupt.
[0032]
[0033] In the beginning, such as in step S201, a CPU of SoC processes a work that is a regular task without interrupt process. The task can be a task A (referring to
[0034] Since the low-priority interrupt is configured to allow accessing the critical section, the data in the critical section can also be accessed by a regular task. When the processor of the SoC is notified through an interrupt flag, a thread of the SoC unmasks the low-priority interrupt. In step S207, a processing function of the low-priority interrupt is allowed to access the critical section.
[0035] Next, when returning the low-priority interrupt, the low-priority interrupt is masked. In step S209, the processor determines whether or not to wake up the unfinished task previously set for the high-priority interrupt. If it is determined that the unfinished task may not be continued, in step S211, the process is terminated and the system goes back to the original task, e.g. task A of
[0036] The embodiments and figures described below are used to depict the process for processing interrupt priority of the disclosure.
Embodiment 1
[0037]
[0038] When the system performs a regular task (task A) (step S301), a high-priority interrupt which generally relates to an instant or emergent task occurs, the system instantly processes the high-priority interrupt (step S303).
[0039] For example, the original task of high-priority interrupt is to access a critical section but the system sets the high-priority interrupt to be always on and prohibits the processing function of the high-priority interrupt from accessing the critical section. Accordingly, the processor uses the flag to set the low-priority interrupt (step S305), and causes the system to be able to handle the low-priority interrupt. In an exemplary example, the processor causes the low-priority interrupt to access and process data in the critical section where the high-priority interrupt was designed to access previously (step S307). After the low-priority interrupt has accessed the data in the critical section, it is determined whether or not to wake up the previous unfinished task, e.g. task B, set for the high-priority interrupt (step S309). If there is still an unfinished task, the system assigns the task B to be the task while returning the low-priority interrupt to wake the task B (step S311).
Embodiment 2
[0040] Reference is made to
[0041] When the processor processes the task set for the low-priority interrupt (step S401), the processor may then take over the high-priority interrupt when receiving a signal of the high-priority interrupt (step S403). After that, when the high-priority interrupt is in process, the high-priority interrupt still communicates with the low-priority interrupt for delivering the message (step S405) for processing the next task set for the low-priority interrupt (step S407). Next, the system determines whether or not to wake up the task B by checking if the previous task set for the high-priority interrupt has been finished (step S409). If the task B set for the high-priority interrupt is not finished, the system assigns the task B to the high-priority interrupt (step S411). The task B is assigned for going on to the unfinished task under the high-priority interrupt.
[0042] According to the above embodiments of the disclosure, in the method for processing the interrupt priority, the system provides a mechanism that re-sets the disabled interrupt and makes the high-priority interrupt to be always on for instantaneously processing the instant task. The low-priority interrupt is masked for processing the regular task for maintaining the characteristics of a disabled interrupt. It should be noted that the instantaneity of the system can be enhanced as well as the disabled interrupt approach satisfying the processing requirement of a critical section.
[0043] In summation, the method for processing interrupt priority and the circuitry system are adapted to the SoC adopting the mechanism of interrupt priority. The method can be used to improve the interrupt service routine of an operating system. The high-performance interrupt processing process allows the high-priority interrupt to respond to any instant circumstance, and the task previously set for the high-priority interrupt can always be prioritized. Therefore, the emergent or the most important task can be processed instantaneously.
[0044] The foregoing description of the exemplary embodiments of the disclosure has been presented only for the purposes of illustration and description and is not intended to be exhaustive or to limit the disclosure to the precise forms disclosed. Many modifications and variations are possible in light of the above teaching.
[0045] The embodiments were chosen and described in order to explain the principles of the disclosure and their practical application so as to enable others skilled in the art to utilize the disclosure and various embodiments and with various modifications as are suited to the particular use contemplated. Alternative embodiments will become apparent to those skilled in the art to which the present disclosure pertains without departing from its spirit and scope.