这是最新(主)开发分支的文档。如果您正在查找以前版本的文档,使用左侧的下拉菜单选择所需的版本。

IRQ API 参考

IRQ

typedef wm_hal_sw_irq_handle wm_drv_sw_irq_handle

IRQ callback type.

typedef wm_hal_hw_irq_handle wm_drv_hw_irq_handle

IRQ callback type.

int wm_drv_irq_attach_hw_vector(wm_irq_no_t irq, wm_drv_hw_irq_handle handle)

Attach hw interrupt vector with callback and replace sw vector. For the registered functions, please add the ATTRIBUTE_ISR attribute and add csi_kernel_intrpt_enter at the beginning and csi_kernel_intrpt_exit at the end.

备注

If hw vector attached, sw vector will be invalidated

参数:
  • irq[in] irq number

  • handle[in] interrupt callback

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_irq_detach_hw_vector(wm_irq_no_t irq)

Detach hw interrupt vector.

参数:

irq[in] irq number

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_irq_attach_sw_vector(wm_irq_no_t irq, wm_drv_sw_irq_handle handle, void *arg)

Attach sw interrupt with callback.

参数:
  • irq[in] irq number

  • handle[in] interrupt callback

  • arg[in] user data

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_irq_detach_sw_vector(wm_irq_no_t irq)

Detach sw interrupt vector.

参数:

irq[in] irq number

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

uint32_t wm_drv_irq_save(void)

Disable global irq and save the previous status.

返回:

last status

void wm_drv_irq_restore(uint32_t irq_state)

Enable global irq by the previous status.

参数:

irq_state[in] previous status by wm_drv_irq_save

int wm_drv_irq_enable(wm_irq_no_t irq)

Enable interrupt.

参数:

irq[in] irq number

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_irq_disable(wm_irq_no_t irq)

Disable interrupt.

参数:

irq[in] irq number

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_irq_set_pending(wm_irq_no_t irq)

Set interrupt with pending.

参数:

irq[in] irq number

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_irq_clear_pending(wm_irq_no_t irq)

Clear interrupt pending status.

参数:

irq[in] irq number

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed

int wm_drv_irq_set_wakeup(wm_irq_no_t irq)

Set wakeup interrupt.

参数:

irq[in] irq number

返回:

  • WM_ERR_SUCCESS: succeed

  • others: failed