libethercat - an embeddable realtime EtherCAT-master library
Communicate with EtherCAT slaves attached to a Network interface.
Loading...
Searching...
No Matches
slave.h File Reference

EtherCAT slave functions. More...

#include <libosal/types.h>
#include "libethercat/config.h"
#include "libethercat/common.h"
#include "libethercat/eeprom.h"
#include "libethercat/dc.h"
#include "libethercat/mbx.h"

Go to the source code of this file.

Data Structures

struct  ec_slave_sm
 slave sync manager settings More...
 
struct  ec_slave_fmmu
 slave fielbus memory management unit (fmmu) settings More...
 
struct  ec_slave_subdev
 EtherCAT sub device. More...
 
struct  ec_init_cmd
 slave mailbox init commands More...
 
struct  worker_arg
 
struct  ec_slave
 

Macros

#define BOOT_2_BOOT   0x0303u
 EtherCAT slave state transitions.
 
#define BOOT_2_INIT   0x0301u
 BOOT to INIT state transition.
 
#define BOOT_2_PREOP   0x0302u
 BOOT to PREOP state transition,.
 
#define BOOT_2_SAFEOP   0x0304u
 BOOT to SAFEOP state transition,.
 
#define BOOT_2_OP   0x0308u
 BOOT to OP state transition,.
 
#define UNKNOWN_2_BOOT   0x0003u
 UNKNOWN to BOOT state transition.
 
#define UNKNOWN_2_INIT   0x0001u
 UNKNOWN to INIT state transition,.
 
#define UNKNOWN_2_PREOP   0x0002u
 UNKNOWN to PREOP state transition,.
 
#define UNKNOWN_2_SAFEOP   0x0004u
 UNKNOWN to SAFEOP state transition,.
 
#define UNKNOWN_2_OP   0x0008u
 UNKNOWN to OP state transition,.
 
#define INIT_2_BOOT   0x0103u
 INIT to BOOT state transition.
 
#define INIT_2_INIT   0x0101u
 INIT to INIT state transition,.
 
#define INIT_2_PREOP   0x0102u
 INIT to PREOP state transition,.
 
#define INIT_2_SAFEOP   0x0104u
 INIT to SAFEOP state transition,.
 
#define INIT_2_OP   0x0108u
 INIT to OP state transition,.
 
#define PREOP_2_BOOT   0x0203u
 PREOP to BOOT state transition,.
 
#define PREOP_2_INIT   0x0201u
 PREOP to INIT state transition,.
 
#define PREOP_2_PREOP   0x0202u
 PREOP to PREOP state transition,.
 
#define PREOP_2_SAFEOP   0x0204u
 PREOP to SAFEOP state transition,.
 
#define PREOP_2_OP   0x0208u
 PREOP to OP state transition,.
 
#define SAFEOP_2_BOOT   0x0403u
 SAFEOP to BOOT state transition,.
 
#define SAFEOP_2_INIT   0x0401u
 SAFEOP to INIT state transition,.
 
#define SAFEOP_2_PREOP   0x0402u
 SAFEOP to PREOP state transition,.
 
#define SAFEOP_2_SAFEOP   0x0404u
 SAFEOP to SAFEOP state transition,.
 
#define SAFEOP_2_OP   0x0408u
 SAFEOP to OP state transition,.
 
#define OP_2_BOOT   0x0803u
 OP to BOOT state transition,.
 
#define OP_2_INIT   0x0801u
 OP to INIT state transition,.
 
#define OP_2_PREOP   0x0802u
 OP to PREOP state transition,.
 
#define OP_2_SAFEOP   0x0804u
 OP to SAFEOP state transition,.
 
#define OP_2_OP   0x0808u
 OP to OP state transition,.
 
#define INIT_CMD_SIZE   (sizeof(ec_init_cmd_t))
 
#define ec_slave_ptr(ptr, pec, slave)
 

Typedefs

typedef osal_uint16_t ec_state_transition_t
 
typedef struct PACKED ec_slave_sm ec_slave_sm_t
 slave sync manager settings
 
typedef struct PACKED ec_slave_fmmu ec_slave_fmmu_t
 slave fielbus memory management unit (fmmu) settings
 
typedef struct ec_slave_subdev ec_slave_subdev_t
 EtherCAT sub device.
 
typedef struct ec_init_cmd ec_init_cmd_t
 slave mailbox init commands
 
typedef struct worker_arg worker_arg_t
 Worker thread argument structure.
 
typedef struct ec_slave ec_slave_t
 

Functions

 LIST_HEAD (ec_init_cmds, ec_init_cmd)
 
void ec_slave_init (struct ec *pec, osal_uint16_t slave)
 
void ec_slave_free (struct ec *pec, osal_uint16_t slave)
 
void ec_slave_reset (ec_t *pec, osal_uint16_t slave)
 issue hardware reset of slave
 
int ec_slave_set_state (struct ec *pec, osal_uint16_t slave, ec_state_t state)
 Set EtherCAT state on slave.
 
int ec_slave_get_state (struct ec *pec, osal_uint16_t slave, ec_state_t *state, osal_uint16_t *alstatcode)
 Get EtherCAT state from slave.
 
int ec_slave_generate_mapping (struct ec *pec, osal_uint16_t slave)
 Generate process data mapping.
 
int ec_slave_prepare_state_transition (struct ec *pec, osal_uint16_t slave, ec_state_t state)
 Prepare state transition on EtherCAT slave.
 
int ec_slave_state_transition (struct ec *pec, osal_uint16_t slave, ec_state_t state)
 Execute state transition on EtherCAT slave.
 
void ec_slave_mailbox_coe_init_cmd_init (ec_init_cmd_t *cmd, int transition, int id, int si_el, int ca_atn, osal_char_t *data, osal_size_t datalen)
 Initialize CoE init command.
 
void ec_slave_add_init_cmd (ec_t *pec, osal_uint16_t slave, ec_init_cmd_t *cmd)
 Add master init command.
 
void ec_slave_set_dc_config (struct ec *pec, osal_uint16_t slave, int use_dc, int type, osal_uint32_t cycle_time_0, osal_uint32_t cycle_time_1, osal_int32_t cycle_shift)
 Set Distributed Clocks config to slave.
 
const osal_char_t * al_status_code_2_string (int code)
 

Detailed Description

EtherCAT slave functions.

Author
Robert Burger rober.nosp@m.t.bu.nosp@m.rger@.nosp@m.dlr..nosp@m.de
Date
21 Nov 2016

These are EtherCAT slave specific configuration functions.