This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:multiasm:cs:chapter_3_12 [2025/01/08 19:30] – ktokarz | en:multiasm:cs:chapter_3_12 [2025/12/12 09:17] (current) – ktokarz | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Interrupt Controller, Interrupts ====== | ====== Interrupt Controller, Interrupts ====== | ||
| - | An interrupt is a request to the processor to temporarily suspend the currently executing code in order to handle the event that caused the interrupt. If the request is accepted by the processor, it saves its state and performs a function named an interrupt handler or interrupt service routine (ISR). Interrupts are usually signalled by peripheral devices in a situation | + | An interrupt is a request to the processor to temporarily suspend the currently executing code in order to handle the event that caused the interrupt. If the request is accepted by the processor, it saves its state and performs a function named an interrupt handler or interrupt service routine (ISR). Interrupts are usually signalled by peripheral devices in a situation |
| - | The interrupt | + | From a hardware perspective, |
| + | * Level triggered - stable low or high level signals | ||
| + | * Edge-triggered - the interrupt is signalled only while there is a change in the interrupt input. The falling or rising edge of the interrupt | ||
| - | After finishing | + | The interrupt signal comes asynchronously, |
| - | The Fig. {{ref> | + | After finishing the interrupt subroutine processor uses the returning address to return program control back to the interrupted code. |
| + | |||
| + | The Fig. {{ref> | ||
| <figure interrupt> | <figure interrupt> | ||
| Line 14: | Line 18: | ||
| </ | </ | ||
| - | ===== Recognizing | + | ===== Recognising |
| - | Fixed – microcontrollers. | + | To properly handle the interrupts, the processor must recognise the source of the interrupt. Different code should be executed when the interrupt is signalled by a network controller, and different code if the source of the interrupt is a timer. The information on the interrupt source is provided to the processor by the interrupt controller or directly by the peripheral. |
| - | every interrupt handler has its own fixed starting address. | + | We can distinguish three main methods of calling a proper ISR for incoming interrupts. |
| - | Vectored – microprocessors. | + | * Fixed – microcontrollers. |
| - | one interrupt pin, peripheral sends address of handler through data bus. | + | |
| - | Indexed – microprocessors. | + | |
| - | peripheral sends number | + | |
| + | In modern processors, interrupts can be signalled with the Message Signalled Interrupt mechanism. While the hardware needs to indicate the interrupt, it exchanges special messages through the chipset to a previously assigned memory address. | ||
| + | ===== Maskable and non-maskable interrupts ===== | ||
| + | Interrupts can be enabled or disabled. Disabling interrupts is often used for time-critical code to ensure the shortest possible execution time. Interrupts which can be disabled are named maskable interrupts. They can be disabled with the corresponding flag in the control register. In microcontrollers, | ||
| - | Maskable | + | If an interrupt can not be disabled |
| - | Interrupts usually can be masked. | + | * memory failure |
| - | In microcotrollers | + | * power down |
| - | Disabling interrupts for time critical code. | + | * critical hardware errors |
| + | In microprocessors, | ||
| - | Non maskable interrupt – cannot be disabled. | ||
| - | Separate interrupt input – NMI. | ||
| - | Reserved usually for critical situation: | ||
| - | Memory failure | ||
| - | Power down | ||
| - | Level triggered. | ||
| - | While interrupt handler is finished and interrupt signal is still active interrupt is signalled again. | ||
| - | Low level on interrput input. | ||
| - | High level on interrupt input. | ||
| - | Edge triggered. | ||
| - | Interrupt is signalled only while there is a change on interrupt input. | ||
| - | Falling edge of interrupt signal. | ||
| - | Rising edge of interrupt signal. | ||
| - | Software interrupts | + | ===== Software |
| - | Internal interrupts | + | In some processors, it is possible to signal the interrupt |
| - | Exception – generated | + | |
| - | Trap – intentionally initiated by programmer transfer control | + | |
| - | Fault – generated while detecting | + | |
| + | Another group of interrupts signalled by the processor itself are internal interrupts. They aren't signalled with special instructions but rather in some specific situations during normal program execution. They are called exceptions and can be divided into three groups. | ||
| + | * Faults – generated by abnormal behaviour in some instructions (e.g. dividing by 0). | ||
| + | * Traps – intentionally initiated by the programmer to transfer control to a handler routine (e.g. for debugging). | ||
| + | * Aborts – generated while detecting some serious errors in the program of computer behaviour (e.g. memory error). | ||
| + | Faults are not real errors. They are often used by the operating system to perform normal operations like handling the paging mechanism. | ||