|  | 
| #define | MAILBOX_WRITE   (osal_uint16_t)(0u) | 
|  | Write mailbox number. 
 | 
|  | 
| #define | MAILBOX_READ   (osal_uint16_t)(1u) | 
|  | Read mailbox number. 
 | 
|  | 
| #define | MESSAGE_POOL_DEBUG(type)   {} | 
|  | 
| #define | ec_mbx_get_free_recv_buffer(pec,  slave,  entry,  timeout,  lock)       pool_get(&(pec)->mbx_message_pool_recv_free, &(entry), (timeout)) | 
|  | 
| #define | ec_mbx_get_free_send_buffer_old(pec,  slave,  entry,  timeout,  lock)       pool_get(&(pec)->mbx_message_pool_send_free, &(entry), (timeout)) | 
|  | 
| #define | ec_mbx_return_free_send_buffer(pec,  slave,  entry)       pool_put(&(pec)->mbx_message_pool_send_free, (entry)) | 
|  | 
| #define | ec_mbx_return_free_recv_buffer(pec,  slave,  entry)       pool_put(&(pec)->mbx_message_pool_recv_free, (entry)) | 
|  | 
|  | 
| typedef struct ec | ec_t | 
|  | 
| typedef struct PACKED ec_mbx_header | ec_mbx_header_t | 
|  | ethercat mailbox header 
 | 
|  | 
| typedef struct PACKED ec_mbx_buffer | ec_mbx_buffer_t | 
|  | ethercat mailbox data 
 | 
|  | 
| typedef struct ec_mbx | ec_mbx_t | 
|  | 
|  | 
| void | ec_mbx_init (ec_t *pec, osal_uint16_t slave) | 
|  | Initialize mailbox structure. 
 | 
|  | 
| void | ec_mbx_deinit (ec_t *pec, osal_uint16_t slave) | 
|  | Deinit mailbox structure. 
 | 
|  | 
| void | ec_mbx_enqueue_head (ec_t *pec, osal_uint16_t slave, pool_entry_t *p_entry) | 
|  | Enqueue mailbox message to send queue. 
 | 
|  | 
| void | ec_mbx_enqueue_tail (ec_t *pec, osal_uint16_t slave, pool_entry_t *p_entry) | 
|  | Enqueue mailbox message to send queue. 
 | 
|  | 
| void | ec_mbx_sched_read (ec_t *pec, osal_uint16_t slave) | 
|  | Trigger read of mailbox. 
 | 
|  | 
| int | ec_mbx_check (ec_t *pec, int slave, osal_uint16_t mbx_flag) | 
|  | Checks if mailbox protocol is supported by slave. 
 | 
|  | 
| int | ec_mbx_next_counter (ec_t *pec, int slave, int *seq_counter) | 
|  | Get next sequence counter. 
 | 
|  | 
| int | ec_mbx_get_free_send_buffer (ec_t *pec, osal_uint16_t slave, pool_entry_t **pp_entry, osal_timer_t *timeout) | 
|  | Get free mailbox send buffer from slaves send message pool. 
 | 
|  | 
| void | ec_mbx_do_handle (ec_t *pec, uint16_t slave) | 
|  | Handle slaves mailbox. 
 | 
|  | 
This modules contains EtherCAT mailbox funcitons. 
◆ anonymous enum
mailbox types 
| Enumerator | 
|---|
| EC_MBX_ERR | error mailbox  | 
| EC_MBX_AOE | ADS over EtherCAT mailbox.  | 
| EC_MBX_EOE | Ethernet over EtherCAT mailbox.  | 
| EC_MBX_COE | CANopen over EtherCAT mailbox.  | 
| EC_MBX_FOE | File over EtherCAT mailbox.  | 
| EC_MBX_SOE | Servo over EtherCAT mailbox.  | 
| EC_MBX_VOE | Vendor over EtherCAT mailbox.  | 
 
 
◆ ec_mbx_check()
      
        
          | int ec_mbx_check | ( | ec_t * | pec, | 
        
          |  |  | int | slave, | 
        
          |  |  | osal_uint16_t | mbx_flag | 
        
          |  | ) |  |  | 
      
 
Checks if mailbox protocol is supported by slave. 
- Parameters
- 
  
    | [in] | pec | Pointer to ethercat master structure, which you got from ec_open. |  | [in] | slave | Number of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached). |  | [in] | mbx_flag | Mailbox protocols flag to be checked |  
 
- Return values
- 
  
    | EC_OK | If all requested protocols supported, otherwise ored error codes. |  | EC_ERROR_MAILBOX_NOT_SUPPORTED_AOE | Mailbox AoE not supported. |  | EC_ERROR_MAILBOX_NOT_SUPPORTED_EOE | Mailbox EoE not supported. |  | EC_ERROR_MAILBOX_NOT_SUPPORTED_COE | Mailbox CoE not supported. |  | EC_ERROR_MAILBOX_NOT_SUPPORTED_FOE | Mailbox FoE not supported. |  | EC_ERROR_MAILBOX_NOT_SUPPORTED_SOE | Mailbox SoE not supported. |  | EC_ERROR_MAILBOX_NOT_SUPPORTED_VOE | Mailbox VoE not supported. |  
 
 
 
◆ ec_mbx_deinit()
      
        
          | void ec_mbx_deinit | ( | ec_t * | pec, | 
        
          |  |  | osal_uint16_t | slave | 
        
          |  | ) |  |  | 
      
 
Deinit mailbox structure. 
- Parameters
- 
  
    | [in] | pec | Pointer to ethercat master structure, which you got from ec_open. |  | [in] | slave | Number of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached). |  
 
 
 
◆ ec_mbx_do_handle()
      
        
          | void ec_mbx_do_handle | ( | ec_t * | pec, | 
        
          |  |  | uint16_t | slave | 
        
          |  | ) |  |  | 
      
 
Handle slaves mailbox. 
This function is usually called by the mbx handler thread.
- Parameters
- 
  
    | [in] | pec | Pointer to ethercat master structure, which you got from ec_open. |  | [in] | slave | Number of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached). |  
 
 
 
◆ ec_mbx_enqueue_head()
      
        
          | void ec_mbx_enqueue_head | ( | ec_t * | pec, | 
        
          |  |  | osal_uint16_t | slave, | 
        
          |  |  | pool_entry_t * | p_entry | 
        
          |  | ) |  |  | 
      
 
Enqueue mailbox message to send queue. 
- Parameters
- 
  
    | [in] | pec | Pointer to ethercat master structure, which you got from ec_open. |  | [in] | slave | Number of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached). |  | [in] | p_entry | Entry to enqueue to be sent via mailbox. |  
 
 
 
◆ ec_mbx_enqueue_tail()
      
        
          | void ec_mbx_enqueue_tail | ( | ec_t * | pec, | 
        
          |  |  | osal_uint16_t | slave, | 
        
          |  |  | pool_entry_t * | p_entry | 
        
          |  | ) |  |  | 
      
 
Enqueue mailbox message to send queue. 
- Parameters
- 
  
    | [in] | pec | Pointer to ethercat master structure, which you got from ec_open. |  | [in] | slave | Number of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached). |  | [in] | p_entry | Entry to enqueue to be sent via mailbox. |  
 
 
 
◆ ec_mbx_get_free_send_buffer()
      
        
          | int ec_mbx_get_free_send_buffer | ( | ec_t * | pec, | 
        
          |  |  | osal_uint16_t | slave, | 
        
          |  |  | pool_entry_t ** | pp_entry, | 
        
          |  |  | osal_timer_t * | timeout | 
        
          |  | ) |  |  | 
      
 
Get free mailbox send buffer from slaves send message pool. 
- Parameters
- 
  
    | [in] | pec | Pointer to ethercat master structure, which you got from ec_open. |  | [in] | slave | Number of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached). |  | [out] | pp_entry | Pointer to pool entry pointer where buffer is returned. |  | [in] | timeout | Pointer to timeout or NULL. |  
 
- Returns
- EC_OK on success, otherwise EC_ERROR_MAILBOX_* code. 
 
 
◆ ec_mbx_init()
      
        
          | void ec_mbx_init | ( | ec_t * | pec, | 
        
          |  |  | osal_uint16_t | slave | 
        
          |  | ) |  |  | 
      
 
Initialize mailbox structure. 
- Parameters
- 
  
    | [in] | pec | Pointer to ethercat master structure, which you got from ec_open. |  | [in] | slave | Number of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached). |  
 
 
 
◆ ec_mbx_next_counter()
      
        
          | int ec_mbx_next_counter | ( | ec_t * | pec, | 
        
          |  |  | int | slave, | 
        
          |  |  | int * | seq_counter | 
        
          |  | ) |  |  | 
      
 
Get next sequence counter. 
- Parameters
- 
  
    | [in] | pec | Pointer to ethercat master structure, which you got from ec_open. |  | [in] | slave | Number of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached). |  | [in] | seq_cnt | Returns sequence counter. |  
 
- Returns
- EC_OK on success. 
 
 
◆ ec_mbx_sched_read()
      
        
          | void ec_mbx_sched_read | ( | ec_t * | pec, | 
        
          |  |  | osal_uint16_t | slave | 
        
          |  | ) |  |  | 
      
 
Trigger read of mailbox. 
- Parameters
- 
  
    | [in] | pec | Pointer to ethercat master structure, which you got from ec_open. |  | [in] | slave | Number of ethercat slave. this depends on the physical order of the ethercat slaves (usually the n'th slave attached). |