IRQ (Interrupt Request) refers to the interrupt requests from devices. The driver provides a set of functions for managing hardware and software interrupts. This module provides interfaces for registering and deregistering both hardware and software interrupts, enabling and disabling interrupts, and managing the pending status of interrupts.
The diagram below illustrates the management of the interrupt vector table.
In interrupt management, a set of software interrupt registration mechanisms is provided. In principle, users only need to register the software table. For performance considerations, interfaces for directly writing to the hardware vector table are also provided. Note that when registering both hardware and software interrupts on the same interrupt vector, the hardware interrupt has higher priority and will overwrite the corresponding software interrupt, causing the software interrupt to fail. If a hardware interrupt is registered first, followed by a software interrupt, the software interrupt cannot be registered.
The first parameter is the interrupt number. The W800 chip has 32 interrupt numbers, each corresponding to an interrupt source on the W800 chip. The type is wm_irq_no_t.
The second parameter is the interrupt callback function, of type wm_drv_hw_irq_handle.
Here, irq_state is used to save the interrupt state, which can then be used to restore the interrupt state. The parameter is the previously saved interrupt state, of type uint32_t.
The function wm_drv_irq_set_wakeup() is called to set a specified interrupt as a wakeup interrupt. When the device is in low-power mode, a wakeup interrupt can trigger the device to resume normal operation from the low-power mode. An example is as follows:
wm_drv_irq_set_wakeup(WM_IRQ_I2C);
The parameter is the interrupt number, of type wm_irq_no_t.