Method and apparatus for processing interrupts at dynamically selectable prioritization levels
A method and apparatus are described by which interrupts from a source may be processed at a dynamically selectable level of priority. A system that has at least two different interrupt request connections, and that responds to interrupts asserted on the different connections by processing interrupts at associated and corresponding different priority levels, is configured so that an interrupt asserted by a particular interrupt source is coupled to a particular one of the plurality of request connections that has been selected under software control. Selective coupling of interrupt source to interrupt request connection may be effected by providing a set of control bits associated with each particular interrupt source, the set consisting, for example, of one interrupt mask bit for each of the different selectable priorities. Control may optionally be provided to preclude simultaneous coupling of an interrupt source to incompatible interrupt request connections.
Latest VIA Telecom Co., Ltd. Patents:
- DEVICES AND METHODS OF MEASURING GAIN OF A VOLTAGE-CONTROLLED OSCILLATOR
- Device and method for access probe enhancements
- Mobile communication devices, service networks, and methods for managing operation of a registration procedure for machine-to-machine (M2M) communications
- Device and method for access probe enhancements
- Apparatus and method for internetworking interface in multimode wireless communication
1. Field of the Invention
This invention relates to computer systems, and particularly to those that provide a hardware mechanism for interrupting program execution.
2. Description of Related Art
Most microprocessors, and indeed more general computing systems, provide at least two different levels of interrupt priority, which may be referred to as High Priority and Low Priority. For simplicity, the description herein begins with a focus on systems having only two such levels of interrupt priority. Low Priority interrupts preempt the normal flow of microprocessor code execution, while High Priority interrupts preempt both the normal flow of code execution, as well as Low Priority interrupts.
Typically, events with a relatively low bandwidth, such as keyboard and mouse operations, are assigned to the Low Priority interrupt, while higher bandwidth events, which could include, for example, responses to USB buffering, MP3 buffering, or Graphics Cards, are assigned to the High Priority interrupt.
Interrupt sources are often pre-assigned to either Low or High interrupt connections as part of the integrated circuit (IC) fabrication process. Event priorities are therefore effectively “hard-wired” into many IC designs before software for the IC is fully developed. Pre-assignment of interrupt priorities can create system design problems, especially for interrupts that are not easily classified as high bandwidth or low bandwidth, or for interrupts that vary in classification.
For example, a UART requires a much higher bandwidth than does a keyboard (Low Priority Interrupt), but a significantly lower bandwidth than a Graphics Controller device (High Priority Interrupt). If a UART is assigned the same interrupt priority as the Graphics Controller device, there is a danger than the Interrupt Service Routine (ISR) associated with the Graphics Controller will not receive timely attention while a UART ISR is in progress. Conversely, if a UART interrupt is assigned the same interrupt priority as lower bandwidth devices, such as a keyboard, then the keyboard interrupt may prevent the UART ISR from receiving timely attention.
Because the prior art forces designers to prioritize interrupts at the time of IC manufacture, which creates potentially serious problems for software development, there is a need for an improved method and apparatus for controlling the assignment of interrupt priorities.
SUMMARY OF THE INVENTIONA method and apparatus for implementing interrupt request connections to a computer is disclosed.
One embodiment of the present invention is a method of enabling microprocessor interrupt source connections to have a selectable priority level. The method includes acts of servicing interrupts at first and second request connections according to corresponding first and second priorities, and of providing request control bits corresponding to a particular source connection and having a software-selectable state. The method also includes acts of responding to an interrupt request asserted at a particular source connection in accordance with the state of the control bits, asserting an interrupt at the first request connection if the control bits are in a first state, and asserting an interrupt at the second request connection if the control bits are in a different state.
Another embodiment of the present invention includes computer apparatus for providing an interrupt request input having a selectable priority level. The apparatus includes a first interrupt request connection for causing an interrupt service routine at a first priority level when presented with an appropriate interrupt request signal, and a second interrupt request connection for causing an interrupt service routine at a second priority level when presented with an appropriate interrupt request signal. The apparatus also includes an interrupt source connection, one or more control bits associated with the source connection, and logic to couple an interrupt from the interrupt source to the first request connection if the control bits are in a first state, and to couple the interrupt to the second request connection if the control bits are in a second state.
Embodiments and details of the invention will be more readily understood by reference to the figures and associated explanation that are provided. Like reference numbers indicate like structure or function throughout.
Each interrupt source typically has an associated mask bit, represented here as high priority mask bits 114, 116 and 118 labeled MH,0, MH,1, and MH,N−1 respectively, and by low priority mask bits 120, 122 and 124 labeled ML,N, ML,N+1, and ML,N+M−1 respectively. These mask bits are typically disposed in registers that are controllable from the microprocessor address/data bus(es).
A mask bit enables or disables interrupts from the interrupt source associated with it by means of appropriate hardware logic, such as an AND gate 126. MH,K indicates a high-priority interrupt mask register bit K, while ML,K indicates a low priority interrupt mask register bit K. H_int indicates a connection to a high priority interrupt request connection of the microprocessor, and L_int indicates a connection to a low priority interrupt request connection of the microprocessor. When enabled (e.g., the corresponding mask bit set to one), an interrupt asserted by any of the high priority sources 102, 104, . . . 106 (e.g., by setting an interrupt assertion bit) will be coupled to a high priority interrupt pin 128 (H_int) (e.g., will cause H_int 128 to also be set). Such coupling may be effected by means of appropriate hardware logic, such as an OR gate 130. Appropriate logic similarly causes a low priority interrupt pin 132 (L_int) to be set as a result of setting any enabled low priority interrupt source bit.
As an example, one may connect a keyboard and mouse to the low priority interrupts IN, IN+1, while connecting USB and MP3 interrupts to the high priority interrupts I0, I1. In general one may have N high priority interrupts and M low priority interrupts, where N and M need not be equal, in a two priority-level system.
If any of the interrupt sources asserts an interrupt, and the corresponding mask register is enabled (e.g., set to “1”), then the interrupt will be coupled to the High Priority interrupt request connection 128 (H_int) or to the Low Priority interrupt request connection 132 (L_int) in accordance with the hardware logic, thus asserting the interrupt at the microprocessor. Consequently, the interrupt will be serviced by a software Interrupt Service Routine (ISR).
Referring now to
In the embodiment shown in
Control and enablement of the interrupt sources may be provided by any appropriate control logic. Control logic in the illustrated example uses AND gates 126 in conjunction with OR gates 230. The OR gates 230 of
Depending upon details of a computer system employing such dual-priority input sources, it may be perfectly acceptable to permit both High and Low Priority masks to be concurrently enabled for a particular interrupt source. Such a system might, for example, respond first to a high priority interrupt, and clear both mask bits, upon initiating execution of the ISR. Thus, the enabling of both the High and Low Priority interrupts would, in some systems, be equivalent to enabling the High Priority interrupt only. Even for extensions into a multiplicity of different priority levels, in some systems, more than one level of priority may be permitted concurrently. Enabling a plurality of priority levels may, as one example, be equivalent to enabling the highest of the enabled priority levels. Thus, in some system designs, it may be permissible to concurrently enable any particular combination of interrupt priority levels.
However, in other system designs it may be useful to preclude the enablement of more than one concurrent priority level for a particular interrupt source. Such a preclusion function may be implemented in software. As one example, software that sets bits in the interrupt masks may be configured to set only one bit at a time for any particular interrupt source, and to first clear all other mask bits for that particular source.
Such a function to preclude concurrently enabling incompatible interrupt priority levels may also be implemented in hardware.
As shown in
Systems may utilize a multiplicity of levels of interrupt priority. While the rules governing processor response to a particular level of interrupt priority may be as complicated as desired, in a simple case each higher level of interrupt will interrupt the microprocessor program, and will also interrupt any ISR running on a lower level of interrupt. The interrupt approach described above may be extended to systems with multiple levels of interrupt priority, irrespective of the number of priority levels provided, and irrespective of the logic by which different levels of priority are processed by the processor.
In
Of course,
Numerous techniques may be employed to enable a set of control bits associated with a particular interrupt source IK to cause that particular source to be selectively coupled to the priority interrupt request connections, and (if desired) to avoid conflicts such as concurrently coupling an interrupt source to incompatible interrupt request connections. An example of a software-based technique for these purposes includes configuring the software that is used to set and clear the control bits of each interrupt source (e.g., mask bits), whereby whenever an interrupt source is to be coupled to an interrupt request connection, all but the appropriate one of the set of control bits (e.g., mask bits) associated with the interrupt source are cleared while the appropriate bit is being set.
Generally, a set of control bits associated with an interrupt source IK need not include a separate bit for each selectable priority interrupt request connection. For example, instead of an individual enable bit for each of the J priority interrupts, as illustrated in
Embodiments of the invention are described above, but the invention is not limited only to those embodiments. It is contemplated that any or all of the exemplary elements of the described embodiments may be replaced by elements that are different from, but equivalent to, the exemplary elements described, and each functional combination of such described elements and/or equivalent elements is considered to be an alternative embodiment of the invention. Thus, each functional combination of elements described above, and of the equivalents of such elements, is contemplated as an embodiment of the invention, excepting of course those combinations that merely constitute examples of the prior art. In view of the difficulties of precision in language, and of the impossibility of explicitly disclosing the entire multitude of ways in which the invention may be embodied, the invention is not to be defined except by the language of the appended claims that are specially provided for such purpose.
Claims
1. A method of providing a selectable priority level to computer interrupt source connections, comprising:
- a) servicing interrupts asserted at a first interrupt request connection according to a first interrupt priority;
- b) servicing interrupts asserted at a different second interrupt request connection at a different second interrupt priority;
- c) providing one or more interrupt request control bits, corresponding to a particular interrupt source connection, having a state that is selectable under software control; and
- d) responding to an assertion of an interrupt request at the particular interrupt request source connection in accordance with the state of the corresponding interrupt request control bits by i) asserting an interrupt request at the first interrupt request connection if the corresponding interrupt request control bits are in a first state during assertion of the interrupt request at the particular interrupt request connection, and ii) asserting an interrupt request at the second interrupt request connection if the corresponding interrupt request control bits are in a different second state during assertion of the interrupt request at the particular interrupt request connection.
2. The method of claim 1, wherein step (c) comprises providing a separate mask bit associated with the particular interrupt request source for enabling each selectable priority level of interrupt.
3. The method of claim 2, wherein step (c) comprises providing logic that precludes setting the mask bits associated with a particular interrupt request source in a condition to concurrently enable a plurality of different priority level interrupts.
4. The method of claim 1, further comprising (e) servicing interrupts asserted at a different third interrupt request connection at a different third interrupt priority.
5. The method of claim 4, wherein step (d) further comprises (iii) asserting an interrupt request at the third interrupt request connection if the corresponding interrupt request control bits are in a different third state during assertion of the interrupt request at the particular interrupt request connection.
6. The method of claim 1, further comprising
- e) providing a multiplicity of interrupt source connections, and
- f) providing a set of one or more interrupt request control bits corresponding to each of the multiplicity of interrupt source connections, each set of interrupt request control bits having a state that is selectable under software control.
7. The method of claim 6, further comprising
- g) servicing interrupts asserted at a multiplicity of different interrupt request connections according to a corresponding multiplicity of interrupt priority levels; and
- h) coupling each interrupt source connection to a corresponding interrupt request connection as indicated by the state of the associated control bits.
8. The method of claim 7, wherein the set of control bits associated with each of the multiplicity of interrupt source connections is software configurable to couple an interrupt on the interrupt source connection to any one or none of the multiplicity of different interrupt request connections.
9. The method of claim 8, wherein step (c) comprises providing a separate mask bit for each interrupt request connection in each set of control bits.
10. Computer apparatus for providing an interrupt source input having a selectable priority level, the apparatus comprising:
- a) a first interrupt request connection configured to cause an interrupt service routine at a first priority level to be initiated when the first request connection is presented with an appropriate interrupt request signal;
- b) a second interrupt request connection configured to cause an interrupt service routine at a different second priority level when presented with an appropriate interrupt request signal;
- c) an interrupt source connection for accepting interrupt request signals from a particular interrupt source;
- d) one or more control bits associated with the interrupt source connection; and
- e) logic configured to couple an interrupt asserted on the interrupt source connection to the first interrupt request connection when the associated control bits are in a first state, and to the second interrupt request connection when the associated control bits are in a different second state.
11. The apparatus of claim 10, further comprising
- f) a plurality of interrupt source connections; and
- g) a different set of one or more interrupt control bits associated with each different interrupt source connection.
12. The apparatus of claim 11, wherein each set of interrupt control bits is configurable in a plurality of different states, including a first state in which the associated interrupt source connection is coupled with the first interrupt request connection, and a second state in which the associated interrupt source connection is coupled with the second interrupt request connection.
13. The apparatus of claim 12, wherein each set of interrupt control bits comprises an interrupt request mask bit for each interrupt request connection that is selectable for the associated interrupt source connection.
14. The apparatus of claim 10, further comprising logic configured to preclude setting the interrupt control bits in a state in which the associated interrupt source connection is coupled with a plurality of different interrupt request connections.
15. The apparatus of claim 10, further comprising at least a third interrupt request connection configured to cause an interrupt service routine at a different third priority level when presented with an appropriate interrupt request signal.
16. The apparatus of claim 15, further comprising a multiplicity of interrupt source connections and a corresponding multiplicity of sets of associated control bits, each set of associated control bits being configurable to selectively couple the associated interrupt source connection to any one of the interrupt request connections.
17. A method of providing a selectable priority level to interrupt source connections of a computer, comprising:
- a) providing a multiplicity of interrupt source connections to a computer;
- b) configuring the computer to i) accept interrupt requests coupled to any one of a multiplicity of different priority interrupt request connections, and to ii) respond to each interrupt request coupled to any particular interrupt request connection by initiating an Interrupt Service Routine at a level of priority corresponding to the particular interrupt request connection;
- c) providing a set of interrupt request control bits corresponding to each of the multiplicity of interrupt source connections, each set of interrupt control bits having a multiplicity of possible states corresponding to the multiplicity of different priority interrupt request connections, the state of at least one set of control bits being selectable under software control to correspond to any selected one of the multiplicity of different priority interrupt request connections; and
- d) responding to an interrupt request asserted at any particular interrupt source connection by coupling the interrupt request to a selected interrupt request connection corresponding to the state of the control bits corresponding to such interrupt source connection.
18. The method of claim 17, further comprising (e) providing at least one null state for each set of control bits that is selectable under software control and corresponds to none of the multiplicity of interrupt request connections, such that when the control bits associated with any particular interrupt source are set to such null state interrupt requests asserted by the particular interrupt source are ignored.
19. The method of claim 18, wherein each set of control bits includes a separate mask bit corresponding to each of the multiplicity of interrupt request connections.
20. The method of claim 19, further comprising controlling the state of the control bits associated with a particular interrupt source by means of hardware logic configured to preclude interrupts asserted by the particular interrupt source from being concurrently coupled to incompatible interrupt connections.
5083261 | January 21, 1992 | Wilkie |
5283904 | February 1, 1994 | Carson et al. |
5781187 | July 14, 1998 | Gephardt et al. |
6295573 | September 25, 2001 | Bailey et al. |
6631394 | October 7, 2003 | Ronkka et al. |
- “Multiple invariant system design for fault-tolerant real-time applications” by Yen, I.L. (abstract only) Publication date: Feb. 1-2, 1996.
- “Fast context switching by hierarchical task allocation and reconfigurable cache” by Tanaka, K. (abstract only) Publication Date: Jul. 17, 2003.
Type: Grant
Filed: Jan 31, 2003
Date of Patent: Aug 9, 2005
Patent Publication Number: 20040153596
Assignee: VIA Telecom Co., Ltd. (Grand Cayman)
Inventor: Anand C. Monteiro (San Diego, CA)
Primary Examiner: Gopal C. Ray
Attorney: Jaquez & Associates
Application Number: 10/356,130