Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

slave.h File Reference


Detailed Description

EtherCAT stave structure.

Definition in file slave.h.

Go to the source code of this file.

Data Structures

struct  ec_sii_string_t
 String object (EEPROM). More...
struct  ec_sii_sync_t
 Sync manager configuration (EEPROM). More...
struct  ec_sii_pdo_t
 PDO description (EEPROM). More...
struct  ec_sii_pdo_entry_t
 PDO entry description (EEPROM). More...
struct  ec_fmmu_t
 FMMU configuration. More...
struct  ec_slave
 EtherCAT slave. More...

Enumerations

enum  ec_slave_state_t {
  EC_SLAVE_STATE_UNKNOWN = 0x00, EC_SLAVE_STATE_INIT = 0x01, EC_SLAVE_STATE_PREOP = 0x02, EC_SLAVE_STATE_SAVEOP = 0x04,
  EC_SLAVE_STATE_OP = 0x08, EC_SLAVE_STATE_ACK_ERR = 0x10
}
 State of an EtherCAT slave. More...
enum  {
  EC_MBOX_AOE = 0x01, EC_MBOX_EOE = 0x02, EC_MBOX_COE = 0x04, EC_MBOX_FOE = 0x08,
  EC_MBOX_SOE = 0x10, EC_MBOX_VOE = 0x20
}
 Supported mailbox protocols. More...
enum  ec_sii_pdo_type_t { EC_RX_PDO, EC_TX_PDO }
 PDO type. More...

Functions

int ec_slave_init (ec_slave_t *, ec_master_t *, uint16_t, uint16_t)
 Slave constructor.
void ec_slave_destroy (ec_slave_t *)
 Slave destructor.
void ec_slave_reset (ec_slave_t *)
 Reset slave from operation mode.
int ec_slave_prepare_fmmu (ec_slave_t *, const ec_domain_t *, const ec_sii_sync_t *)
 Prepares an FMMU configuration.
void ec_slave_request_state (ec_slave_t *, ec_slave_state_t)
int ec_slave_fetch_strings (ec_slave_t *, const uint8_t *)
 Fetches data from a STRING category.
void ec_slave_fetch_general (ec_slave_t *, const uint8_t *)
 Fetches data from a GENERAL category.
int ec_slave_fetch_sync (ec_slave_t *, const uint8_t *, size_t)
 Fetches data from a SYNC MANAGER category.
int ec_slave_fetch_pdo (ec_slave_t *, const uint8_t *, size_t, ec_sii_pdo_type_t)
 Fetches data from a [RT]XPDO category.
int ec_slave_locate_string (ec_slave_t *, unsigned int, char **)
 Searches the string list for an index and allocates a new string.
uint16_t ec_slave_calc_sync_size (const ec_slave_t *, const ec_sii_sync_t *)
 Calculates the size of a sync manager by evaluating PDO sizes.
int ec_slave_is_coupler (const ec_slave_t *)
int ec_slave_has_subbus (const ec_slave_t *)
int ec_slave_validate (const ec_slave_t *, uint32_t, uint32_t)
void ec_slave_sdo_dict_info (const ec_slave_t *, unsigned int *, unsigned int *)
 Counts the total number of SDOs and entries in the dictionary.


Enumeration Type Documentation

enum ec_slave_state_t
 

State of an EtherCAT slave.

Enumerator:
EC_SLAVE_STATE_UNKNOWN  unknown state
EC_SLAVE_STATE_INIT  INIT state (no mailbox communication, no IO).
EC_SLAVE_STATE_PREOP  PREOP state (mailbox communication, no IO).
EC_SLAVE_STATE_SAVEOP  SAVEOP (mailbox communication and input update).
EC_SLAVE_STATE_OP  OP (mailbox communication and input/output update).
EC_SLAVE_STATE_ACK_ERR  Acknowledge/Error bit (no actual state).

Definition at line 58 of file slave.h.

anonymous enum
 

Supported mailbox protocols.

Enumerator:
EC_MBOX_AOE  ADS-over-EtherCAT.
EC_MBOX_EOE  Ethernet-over-EtherCAT.
EC_MBOX_COE  CANopen-over-EtherCAT.
EC_MBOX_FOE  File-Access-over-EtherCAT.
EC_MBOX_SOE  Servo-Profile-over-EtherCAT.
EC_MBOX_VOE  Vendor specific.

Definition at line 81 of file slave.h.

enum ec_sii_pdo_type_t
 

PDO type.

Enumerator:
EC_RX_PDO  Reveive PDO.
EC_TX_PDO  Transmit PDO.

Definition at line 131 of file slave.h.


Function Documentation

int ec_slave_init ec_slave_t slave,
ec_master_t master,
uint16_t  ring_position,
uint16_t  station_address
 

Slave constructor.

Returns:
0 in case of success, else < 0
Parameters:
slave  EtherCAT slave
master  EtherCAT master
ring_position  ring position
station_address  station address to configure

Definition at line 100 of file slave.c.

void ec_slave_destroy ec_slave_t slave  ) 
 

Slave destructor.

Clears and frees a slave object.

Parameters:
slave  EtherCAT slave

Definition at line 210 of file slave.c.

int ec_slave_prepare_fmmu ec_slave_t slave,
const ec_domain_t domain,
const ec_sii_sync_t sync
 

Prepares an FMMU configuration.

Configuration data for the FMMU is saved in the slave structure and is written to the slave in ecrt_master_activate(). The FMMU configuration is done in a way, that the complete data range of the corresponding sync manager is covered. Seperate FMMUs are configured for each domain. If the FMMU configuration is already prepared, the function returns with success.

Returns:
0 in case of success, else < 0
Parameters:
slave  EtherCAT slave
domain  domain
sync  sync manager

Definition at line 568 of file slave.c.

int ec_slave_fetch_strings ec_slave_t slave,
const uint8_t *  data
 

Fetches data from a STRING category.

Returns:
0 in case of success, else < 0
Parameters:
slave  EtherCAT slave
data  category data

Definition at line 349 of file slave.c.

void ec_slave_fetch_general ec_slave_t slave,
const uint8_t *  data
 

Fetches data from a GENERAL category.

Returns:
0 in case of success, else < 0
Parameters:
slave  EtherCAT slave
data  category data

Definition at line 387 of file slave.c.

int ec_slave_fetch_sync ec_slave_t slave,
const uint8_t *  data,
size_t  word_count
 

Fetches data from a SYNC MANAGER category.

Returns:
0 in case of success, else < 0
Parameters:
slave  EtherCAT slave
data  category data
word_count  number of words

Definition at line 410 of file slave.c.

int ec_slave_fetch_pdo ec_slave_t slave,
const uint8_t *  data,
size_t  word_count,
ec_sii_pdo_type_t  pdo_type
 

Fetches data from a [RT]XPDO category.

Returns:
0 in case of success, else < 0
Parameters:
slave  EtherCAT slave
data  category data
word_count  number of words
pdo_type  PDO type

Definition at line 448 of file slave.c.

int ec_slave_locate_string ec_slave_t slave,
unsigned int  index,
char **  ptr
 

Searches the string list for an index and allocates a new string.

Returns:
0 in case of success, else < 0
Todo:
documentation
Parameters:
slave  EtherCAT slave
index  string index
ptr  Address of the string pointer

Definition at line 510 of file slave.c.

uint16_t ec_slave_calc_sync_size const ec_slave_t slave,
const ec_sii_sync_t sync
 

Calculates the size of a sync manager by evaluating PDO sizes.

Returns:
sync manager size
Parameters:
slave  EtherCAT slave
sync  sync manager

Definition at line 944 of file slave.c.

int ec_slave_is_coupler const ec_slave_t slave  ) 
 

Returns:
non-zero if slave is a bus coupler
Parameters:
slave  EtherCAT slave

Definition at line 980 of file slave.c.

int ec_slave_has_subbus const ec_slave_t slave  ) 
 

Returns:
non-zero if slave is a bus coupler
Parameters:
slave  EtherCAT slave

Definition at line 993 of file slave.c.

int ec_slave_validate const ec_slave_t slave,
uint32_t  vendor_id,
uint32_t  product_code
 

Returns:
0 in case of success, else < 0
Parameters:
slave  EtherCAT slave
vendor_id  vendor ID
product_code  product code

Definition at line 1046 of file slave.c.


Generated on Tue Nov 7 15:03:37 2006 for IgH EtherCAT master by  doxygen 1.4.4