This is the documentation for the latest (main) development branch. If you are looking for the documentation of previous releases, use the drop-down menu on the left and select the desired version.
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 software vectors. However, for performance reasons, an interface for directly writing to the hardware vector table is also provided. Note that when both hardware and software interrupts are registered on the same interrupt vector, the hardware interrupt has a higher priority and will override the corresponding software interrupt, rendering the software interrupt ineffective. If a hardware interrupt is registered first, the software interrupt cannot be registered afterward.
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. You can use this saved state to restore the interrupt state. The parameter is the previously saved interrupt state, of type uint32_t.
Call the function wm_drv_irq_set_wakeup() 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. Example:
wm_drv_irq_set_wakeup(WM_IRQ_I2C);
The parameter is the interrupt number, of type wm_irq_no_t.