BK_MBOX

[English]

BK_MBOX API Status

API

bk_mbox_open()

bk_mbox_close()

bk_mbox_write()

bk_mbox_write_wait_response()

bk_mbox_read()

bk_mbox_rx_data_is_ready()

bk_mbox_reg_rx_ready_callback()

bk_mbox_release()

BK_MBOX API Reference

Header File

Functions

uint32_t bk_mbox_open(int32_t remote_cpu)

beken mailbox open.

参数:

remote_cpu[in] CPU_ID_xx

返回值:
  • 0 – fail

  • other – success

返回:

handle

int32_t bk_mbox_close(uint32_t handle)

beken mailbox close.

使用mailbox结束后需要close,和 bk_mbox_open() 是配对的

参数:

handle[in] return value of bk_mbox_open()

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

int32_t bk_mbox_write(uint32_t handle, uint8_t *pu1_buf, uint16_t buf_len)

通过mailbox送数据给对方cpu,该函数立即返回

硬件FIFO数量固定,尽量使用一收一发的工作模式

参数:
  • handle[in] return value of bk_mbox_open()

  • pu1_buf[in] pointer to the tx buffer

  • buf_len[in] tx buffer length in bytes

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

int32_t bk_mbox_write_wait_response(uint32_t handle, uint8_t *pu1_buf, uint16_t buf_len)

通过mailbox送数据给对方cpu

该函数会等到有对方cpu回复后再返回,但是用户需要自己去读取数据

参数:
  • handle[in] return value of bk_mbox_open()

  • pu1_buf[in] pointer to the tx buffer

  • buf_len[in] tx buffer length in bytes

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

int32_t bk_mbox_read(uint32_t handle, uint8_t *pu1_buf, uint16_t *pu2_buf_len)

read data from maiblox

参数:
  • handle[in] return value of bk_mbox_open()

  • pu1_buf[in] pointer to the rx buffer

  • pu2_buf_len[out] 输出参数,表示这次接收的数据长度

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

bool bk_mbox_rx_data_is_ready(uint32_t handle)

check if rx data is ready or not.

参数:

handle[in] return value of bk_mbox_open()

返回:

true: data is ready false: no data

int32_t bk_mbox_reg_rx_ready_callback(uint32_t handle, pfunc_mbox_rxready_t pfn_cb, void *pv_arg)

register rx ready callback.

参数:
  • handle[in] return value of bk_mbox_open()

  • pfn_cb[in] callback function for rx ready

  • pv_arg[in] argument for callback

返回值:
  • 0 – success [BK_RET_OK]

  • other – fail

返回:

result

void bk_mbox_release(uint32_t handle)

release mailbox for main cpu.

参数:

handle[in] return value of bk_mbox_open()

返回:

N/A

Macros

MBOX_EXCHG_MAX_WORD
CacheOffset

Type Definitions

typedef void (*pfunc_mbox_rxready_t)(void *pv_arg)
typedef enum _MAILBOX_CMD_SET MAILBOX_CMD_SET

Enumerations

enum _MAILBOX_CMD_SET

Values:

enumerator MAILBOX_CMD_ENC_SUBSET
enumerator MAILBOX_CMD_ENC_INIT
enumerator MAILBOX_CMD_ENC_UINIT
enumerator MAILBOX_CMD_ENC_TRIG
enumerator MAILBOX_CMD_TEST_SUBSET
enumerator MAILBOX_CMD_OTHER_SUBSET