SPRUHZ7K August 2015 – April 2024 AM5706 , AM5708 , AM5716 , AM5718 , AM5718-HIREL
Table 28-15 lists the keyboard controller event servicing.
| Step | Register/Bit Field/Programming Model | Value |
|---|---|---|
| Clear all eventual previous indications of treated interrupts; write the IRQSTATUS register: | KBD_IRQSTATUS | 0x0000000F |
| Enable the desired sources of interrupt by writing in: | KBD_IRQENABLE | 0x0000000– |
| Unmask (enable) the desired sources of interrupt by writing logical 1 in the desired bit fields. | KBD_IRQWAKEEN | 0x0000000– |
| When event occurs: | ||
| Read the status register. | KBD_IRQSTATUS | |
| IF: KBD_IRQSTATUS[3] MISS_EVENT = 1 | Start the interrupt handler for missed event. | |
| ELSIF: KBD_IRQSTATUS[2] IT_TIMEOUT = 1 | Start the interrupt handler for timeout event. | |
| ELSIF: KBD_IRQSTATUS[1] IT_LONG_KEY = 1 | Start the interrupt handler for long key pressed event. | |
| ELSIF: KBD_IRQSTATUS[0] IT_EVENT = 1 | Start the interrupt handler for pressed key event. | |
| ENDIF | ||
| Wait for the execution of the corresponding interrupt handler. | Interrupt controller of the MPU | |
| Clear the corresponding IRQ status register bits by writing 1 there. | KBD_IRQSTATUS | 0x0000000– |
| Disable the corresponding sources of interrupt if needed by writing 0 at the corresponding bit fields. | KBD_IRQENABLE or KBD_IRQWAKEEN | 0x0000000- |
| Read the status register. | KBD_IRQSTATUS | |
| IF : | KBD_IRQSTATUS[2] IT_TIMEOUT | =1 |
| Handle the timeout event. | ||
| Clear the corresponding status flag. | KBD_IRQSTATUS[2] IT_TIMEOUT | 0x1 |
| ELSE IF: | KBD_IRQSTATUS[1] IT_LONG_KEY | =1 |
| Handle the long pressed key event. | ||
| Clear the corresponding status flag. | KBD_IRQSTATUS[1] IT_LONG_KEY | 0x1 |
| ELSE IF: | KBD_IRQSTATUS[0] IT_EVENT | =1 |
| Handle the pressed key event. | ||
| Clear the corresponding status flag. | KBD_IRQSTATUS[0] IT_EVENT | 0x1 |
| ENDIF | ||
| Disable the interrupts if needed. | KBD_IRQENABLE_CLR[2:0] | 0x1 |