Interrupt Control Unit

[English]

Beken chip supports interrupt service function registe for user.

Interrupt API Status

API

BK7237

BK7237_cp1

bk_int_isr_register()

Y

Y

bk_int_isr_unregister()

Y

Y

bk_int_set_priority()

Y

Y

bk_int_set_group()

Y

Y

bk_get_int_statis()

Y

Y

bk_dump_int_statis()

Y

Y

Interrupt API Reference

Header File

Functions

bk_err_t bk_icu_driver_init(void)

Init the ICU driver.

This API init the icu modules :

  • Init ICU driver control memory, enable fiq and irq

This API should be called before any other ICU APIs.

Returns

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_icu_driver_deinit(void)

deinit the ICU driver

This API deinit the icu module

This API disable all devices’ intterrupts

Returns

  • BK_OK: succeed

  • others: other errors.

bk_err_t bk_int_isr_register(icu_int_src_t dev, int_group_isr_t isr, void *arg)

register interrupt service handler

Attention

1. If this is called, the default interrupt handler is replaced by the new handler, the caller is fully responsible for handling the interrupt, such as, read the interrupt status, clear the interrupt status and processing the interrupt etc.

Parameters
  • dev – interrupt source device

  • isr – int service function

Returns

  • BK_OK: succeed

  • BK_ERR_NO_MEM: no memoery

  • BK_ERR_INT_DEVICE_NONE: no int device

  • others: other errors.

bk_err_t bk_int_isr_unregister(icu_int_src_t src)

unregister interrupt service handler

Parameters

dev – interrupt source device

Returns

  • BK_OK: succeed

  • BK_ERR_INT_DEVICE_NONE:no int device

  • others: other errors.

bk_err_t bk_int_set_priority(icu_int_src_t src, uint32_t int_priority)

set/change interrupt priority

Every interrupt source has a two-level priority, the group priority and the priority. The interrupt source has higher group priority will be schedule first. The interrupt sources has higher priority will be schedule first if they has the same group priority.

This API is used to configure the pririty.

Parameters
  • dev – interrupt source device

  • isr – int service function

Returns

  • BK_OK: succeed

  • BK_ERR_NOT_SUPPORT :not support

  • others: other errors.

bk_err_t bk_int_set_group(void)

set the interrupt group priority

Every interrupt source has a two-level priority, the group priority and the priority. The interrupt source has higher group priority will be schedule first. The interrupt sources has higher priority will be schedule first if they has the same group priority.

This API is used to configure the group priority of the interrupt source.

Attention

1. For ARM9, it has two group priorities which are mapped to ARM9 FIQ and IRQ. Currently all interrupt source are statically mapped to the group priority and can’t change by this API. We may support it in future.

Returns

  • BK_OK: succeed

  • BK_ERR_NOT_SUPPORT :not support

  • others: other errors.

bk_err_t bk_int_register_mac_ps_callback(int_mac_ps_callback_t mac_ps_cb)

Register callback for mac ps.

Parameters

mac_ps_cb – mac ps callback

Returns

  • BK_OK: succeed

  • others: other errors.

Interrupt API Typedefs

Header File

Macros

BK_ERR_INT_DEVICE_NONE

icu device number is invalid

BK_ERR_INT_NOT_EXIST

icu device number is invalid

Type Definitions

typedef void (*int_mac_ps_callback_t)(uint32_t status)

Enumerations

enum icu_int_src_t

Values:

enumerator INT_SRC_UART0
enumerator INT_SRC_UART1
enumerator INT_SRC_I2C0
enumerator INT_SRC_IRDA
enumerator INT_SRC_I2S
enumerator INT_SRC_I2C1
enumerator INT_SRC_SPI
enumerator INT_SRC_GPIO
enumerator INT_SRC_TIMER
enumerator INT_SRC_PWM
enumerator INT_SRC_AUDIO
enumerator INT_SRC_SARADC
enumerator INT_SRC_SDIO
enumerator INT_SRC_USB
enumerator INT_SRC_FFT
enumerator INT_SRC_GDMA
enumerator INT_SRC_MODEM
enumerator INT_SRC_MAC_TXRX_TIMER
enumerator INT_SRC_MAC_TXRX_MISC
enumerator INT_SRC_MAC_RX_TRIGGER
enumerator INT_SRC_MAC_TX_TRIGGER
enumerator INT_SRC_MAC_PROT_TRIGGER
enumerator INT_SRC_MAC_GENERAL
enumerator INT_SRC_SDIO_DMA
enumerator INT_SRC_USB_PLUG_INOUT
enumerator INT_SRC_SECURITY
enumerator INT_SRC_MAC_WAKEUP
enumerator INT_SRC_HSSPI_SLAVE
enumerator INT_SRC_PLL_UNLOCK
enumerator INT_SRC_JPEG
enumerator INT_SRC_BLE
enumerator INT_SRC_PSRAM
enumerator INT_SRC_LA
enumerator INT_SRC_BTDM
enumerator INT_SRC_BT
enumerator INT_SRC_UART2
enumerator INT_SRC_I2C2
enumerator INT_SRC_SPI2
enumerator INT_SRC_SPI3
enumerator INT_SRC_PWM2
enumerator INT_SRC_USB2
enumerator INT_SRC_MAILBOX0
enumerator INT_SRC_MAILBOX1
enumerator INT_SRC_BT_WDT
enumerator INT_SRC_DSP_WDT
enumerator INT_SRC_RTC
enumerator INT_SRC_TOUCH
enumerator INT_SRC_CEC
enumerator INT_SRC_MODEM_RC
enumerator INT_SRC_MAC_HSU
enumerator INT_SRC_NONE