Mailbox functionality.
More...
Go to the source code of this file.
|
| enum | {
EC_MBOX_TYPE_EOE = 0x02,
EC_MBOX_TYPE_COE = 0x03,
EC_MBOX_TYPE_FOE = 0x04,
EC_MBOX_TYPE_SOE = 0x05,
EC_MBOX_TYPE_VOE = 0x0f
} |
| | Mailbox types. More...
|
| |
Mailbox functionality.
Definition in file mailbox.h.
◆ anonymous enum
Mailbox types.
These are used in the 'Type' field of the mailbox header.
Definition at line 46 of file mailbox.h.
◆ ec_slave_mbox_prealloc()
Allocates the mailbox response buffers of a slave.
The buffers are allocated for the mailbox protocols supported by the slave. They are allocated only once and freed with the slave, because the receive path may write to them at any time. So they are dimensioned for the largest TX mailbox, that can be configured during the lifetime of the slave object (standard and bootstrap mailbox, sync manager configuration from the SII and the currently configured mailbox).
- Parameters
-
Definition at line 100 of file mailbox.c.
◆ ec_slave_mbox_prepare_send()
| uint8_t* ec_slave_mbox_prepare_send |
( |
const ec_slave_t * |
slave, |
|
|
ec_datagram_t * |
datagram, |
|
|
uint8_t |
type, |
|
|
size_t |
size |
|
) |
| |
Prepares a mailbox-send datagram.
- Returns
- Pointer to mailbox datagram data, or ERR_PTR() code.
- Parameters
-
| slave | slave |
| datagram | datagram |
| type | mailbox protocol |
| size | size of the data |
Definition at line 143 of file mailbox.c.
◆ ec_slave_mbox_prepare_check()
Prepares a datagram for checking the mailbox state.
- Todo:
- Determine sync manager used for receive mailbox
- Returns
- 0 in case of success, else < 0
- Parameters
-
| slave | slave |
| datagram | datagram |
Definition at line 188 of file mailbox.c.
◆ ec_slave_mbox_check()
Processes a mailbox state checking datagram.
- Returns
- 0 in case of success, else < 0
- Parameters
-
Definition at line 207 of file mailbox.c.
◆ ec_slave_mbox_prepare_fetch()
Prepares a datagram to fetch mailbox data.
- Returns
- 0 in case of success, else < 0
- Parameters
-
| slave | slave |
| datagram | datagram |
Definition at line 219 of file mailbox.c.
◆ ec_slave_mbox_take_error()
Takes over a mailbox error response from a mailbox fetch datagram.
Mailbox error responses (type 0x00) can not be assigned to a protocol, so the mailbox dispatcher leaves them in the memory of the fetch datagram. This function stores such a response in the protocol buffer of the fetching state machine, so that ec_slave_mbox_fetch() reports the error.
The fetch datagram is zeroed in ec_slave_mbox_prepare_fetch(), so the length field is zero, if the response was dispatched to a protocol buffer.
- Parameters
-
| mbox_data | protocol buffer of the fetching FSM |
| datagram | mailbox fetch datagram |
Definition at line 246 of file mailbox.c.
◆ ec_slave_mbox_fetch()
| uint8_t* ec_slave_mbox_fetch |
( |
const ec_slave_t * |
slave, |
|
|
ec_mbox_data_t * |
response_data, |
|
|
uint8_t * |
type, |
|
|
size_t * |
size |
|
) |
| |
Processes received mailbox data.
The response is consumed, i. e. the response buffer is marked as empty.
- Returns
- Pointer to the received data, or ERR_PTR() code.
- Parameters
-
| slave | slave |
| response_data | response |
| type | expected mailbox protocol |
| size | size of the received data |
Definition at line 290 of file mailbox.c.