#include <types.h>
#include <compiler.h>
#include <sdrv_common.h>
Go to the source code of this file.
|
| int | sdrv_mbox_received (sdrv_mbox_chan_t *chan, uint8_t *data, uint32_t len) |
| |
| status_t | sdrv_mbox_send_nobuf (sdrv_mbox_chan_t *sdrv_chan, uint8_t *data, uint32_t len, uint32_t timeout) |
| |
| status_t | sdrv_mbox_send (sdrv_mbox_chan_t *sdrv_chan, uint8_t *data, uint32_t len, uint32_t timeout) |
| |
| uint8_t * | sdrv_mbox_alloc_buffer (sdrv_mbox_chan_t *sdrv_chan, uint32_t len) |
| |
| status_t | sdrv_mbox_send_nocopy (sdrv_mbox_chan_t *chan, uint8_t *data, uint32_t len, uint32_t timeout) |
| |
| sdrv_mbox_chan_t * | sdrv_mbox_request_channel (sdrv_mbox_t *dev, sdrv_mbox_chan_req_t *chan_req) |
| |
| status_t | sdrv_mbox_release_channel (sdrv_mbox_chan_t *chan) |
| |
| status_t | sdrv_mbox_set_callback (sdrv_mbox_chan_t *chan, sdrv_mbox_rxcallback callback, void *arg) |
| |
| uint32_t | sdrv_mbox_mtu (sdrv_mbox_t *dev) |
| |
| status_t | sdrv_mbox_init (sdrv_mbox_t *dev, const sdrv_mbox_config_t *cfg) |
| |
- Copyright
- copyright description (c) 2022 Semidrive Semiconductor. All rights reserved.
Revision History:
◆ SDRV_MBOX_ANY_ADDR
| #define SDRV_MBOX_ANY_ADDR -1 |
◆ SDRV_MBOX_CHN_NUM
| #define SDRV_MBOX_CHN_NUM 8U |
◆ SDRV_MBOX_NO_WAIT
| #define SDRV_MBOX_NO_WAIT 0U |
◆ SDRV_MBOX_SHORT_BUF_LEN
| #define SDRV_MBOX_SHORT_BUF_LEN 4U |
◆ SDRV_MBOX_WAIT_FOREVER
| #define SDRV_MBOX_WAIT_FOREVER 0xffffffffU |
◆ sdrv_mbox_chan_req_t
◆ sdrv_mbox_chan_t
◆ sdrv_mbox_config_t
◆ sdrv_mbox_rxcallback
| typedef int(* sdrv_mbox_rxcallback) (void *arg, uint8_t *data, uint32_t len) |
◆ sdrv_mbox_t
◆ sdrv_mbox_addr_t
sdrv mbox address id
Mbox address id is used to define different mbox message types, especially for the frequent used messages, such as rpmsg or power-manage. Raw data (MBOX_ADDR_RAW) is usually chosen for the messages without any type.
| Enumerator |
|---|
| MBOX_ADDR_INVALID | |
| MBOX_ADDR_RAW | |
| MBOX_ADDR_IPCC | |
| MBOX_ADDR_RPMSG | |
| MBOX_ADDR_PM | |
◆ sdrv_mbox_error
mbox status error code.
| Enumerator |
|---|
| SDRV_MBOX_STATUS_INVALID_MASTERID | |
| SDRV_MBOX_STATUS_LENGTH_ERROR | |
| SDRV_MBOX_STATUS_NO_CHANNEL | |
| SDRV_MBOX_STATUS_NO_MSG_BUFFER | |
| SDRV_MBOX_STATUS_TIMEOUT | |
◆ sdrv_mbox_proc_id_t
| Enumerator |
|---|
| MBOX_PROC_ID_SF | |
| MBOX_PROC_ID_SP0 | |
| MBOX_PROC_ID_SP1 | |
| MBOX_PROC_ID_SX0 | |
| MBOX_PROC_ID_SX1 | |
| MBOX_PROC_ID_NUM | |
◆ sdrv_mbox_rproc_t
sdrv mbox remote processor bitmap
Multi remote processors can be combined by the symbol '|', for example, MBOX_RPROC_SF | MBOX_RPROC_SP0.
| Enumerator |
|---|
| MBOX_RPROC_SF | |
| MBOX_RPROC_SP0 | |
| MBOX_RPROC_SP1 | |
| MBOX_RPROC_SX0 | |
| MBOX_RPROC_SX1 | |
◆ sdrv_mbox_alloc_buffer()
sdrv mbox channel allocate buffer
This function allocates data buffers, and copy mailbox data to the buffers first. And then, another function (sdrv_mbox_send_nocopy) is called to send mailbox data.
- Parameters
-
| [in] | chan | mbox channel |
| [in] | len | data length, unit: 2 bytes return buffer address |
◆ sdrv_mbox_init()
sdrv mbox init
This function initializes mailbox device.
- Parameters
-
| [in] | dev | sdrv mbox device |
| [in] | cfg | sdrv mbox configuration |
◆ sdrv_mbox_mtu()
sdrv mbox get mtu
This function gets maximum transmission unit.
- Parameters
-
- Returns
- mtu
◆ sdrv_mbox_received()
| int sdrv_mbox_received |
( |
sdrv_mbox_chan_t * |
chan, |
|
|
uint8_t * |
data, |
|
|
uint32_t |
len |
|
) |
| |
sdrv mbox receive message
This function receives mailbox message data. It should be called before other core send mailbox data.
- Parameters
-
| [in] | chan | sdrv mbox channel |
| [in] | data | msg data |
| [in] | msg | len |
- Returns
- receive result
◆ sdrv_mbox_release_channel()
sdrv mbox release channel
- Parameters
-
- Returns
- SDRV_STATUS_OK or error code
◆ sdrv_mbox_request_channel()
sdrv mbox client request channel
- Parameters
-
| [in] | dev | mbox dev |
| [in] | chan_req | mbox channel request param |
- Returns
- mbox channel
◆ sdrv_mbox_send()
sdrv mbox channel send data use message buf
This function is used to send mailbox data in standard flow:
- allocate data buffers
- copy data to the buffers
- send data from the buffers
- Parameters
-
| [in] | chan | mbox channel |
| [in] | data | data ptr |
| [in] | len | data length, unit: 2 bytes |
| [in] | timeout | wait timeout(millisecond), timeout should not be too small. return send result |
◆ sdrv_mbox_send_nobuf()
sdrv mbox channel send short data
This function is used to send mailbox data without buffers. The data length is not more than 4 bytes. The mailbox data will be saved in registers and send directly.
- Parameters
-
| [in] | chan | mbox channel |
| [in] | data | data ptr |
| [in] | len | data length, unit: 2 bytes |
| [in] | timeout | wait timeout(millisecond), timeout should not be too small. return send result |
◆ sdrv_mbox_send_nocopy()
sdrv mbox channel send data no copy
This function is used to send mailbox data without repeating to copy data. This function is combined with the function sdrv_mbox_alloc_buffer, sending the data which have been stored in the buffer.
- Parameters
-
| [in] | chan | mbox channel |
| [in] | data | data ptr |
| [in] | len | data length, unit: 2 bytes |
| [in] | timeout | wait timeout(millisecond), timeout should not be too small. |
- Returns
- send result
◆ sdrv_mbox_set_callback()
sdrv mbox set callback
This function sets mailbox callback function.
- Parameters
-
| [in] | chan | sdrv mbox channel |
| [in] | callback | callback function |
| [in] | arg | callback argument |
- Returns
- SDRV_STATUS_OK or error code