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

slave.c File Reference


Detailed Description

EtherCAT slave methods.

Definition in file slave.c.

Go to the source code of this file.

Functions

void ec_slave_clear (struct kobject *kobj)
 Clear and free slave.
void ec_slave_sdos_clear (struct kobject *kobj)
ssize_t ec_show_slave_attribute (struct kobject *kobj,struct attribute *attr,char *buffer)
 Formats attribute data for SysFS read access.
ssize_t ec_store_slave_attribute (struct kobject *kobj,struct attribute *attr,const char *buffer,size_t size)
 Formats attribute data for SysFS write access.
int ec_slave_init (ec_slave_t *slave, ec_master_t *master, uint16_t ring_position, uint16_t station_address)
 Slave constructor.
void ec_slave_destroy (ec_slave_t *slave)
 Slave destructor.
void ec_slave_reset (ec_slave_t *slave)
 Reset slave from operation mode.
void ec_slave_request_state (ec_slave_t *slave, ec_slave_state_t state)
int ec_slave_fetch_strings (ec_slave_t *slave, const uint8_t *data)
 Fetches data from a STRING category.
void ec_slave_fetch_general (ec_slave_t *slave, const uint8_t *data)
 Fetches data from a GENERAL category.
int ec_slave_fetch_sync (ec_slave_t *slave, const uint8_t *data, size_t word_count)
 Fetches data from a SYNC MANAGER category.
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.
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.
int ec_slave_prepare_fmmu (ec_slave_t *slave, const ec_domain_t *domain, const ec_sii_sync_t *sync)
 Prepares an FMMU configuration.
size_t ec_slave_info (const ec_slave_t *slave, char *buffer)
 Outputs all information about a certain slave.
ssize_t ec_slave_write_eeprom (ec_slave_t *slave, const uint8_t *data, size_t size)
 Schedules an EEPROM write operation.
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.
int ec_slave_is_coupler (const ec_slave_t *slave)
int ec_slave_has_subbus (const ec_slave_t *slave)
int ec_slave_conf_sdo (ec_slave_t *slave, uint16_t sdo_index, uint8_t sdo_subindex, const uint8_t *data, size_t size)
int ec_slave_validate (const ec_slave_t *slave, uint32_t vendor_id, uint32_t product_code)
void ec_slave_sdo_dict_info (const ec_slave_t *slave, unsigned int *sdo_count, unsigned int *entry_count)
 Counts the total number of SDOs and entries in the dictionary.
int ecrt_slave_conf_sdo8 (ec_slave_t *slave, uint16_t sdo_index, uint8_t sdo_subindex, uint8_t value)
int ecrt_slave_conf_sdo16 (ec_slave_t *slave, uint16_t sdo_index, uint8_t sdo_subindex, uint16_t value)
int ecrt_slave_conf_sdo32 (ec_slave_t *slave, uint16_t sdo_index, uint8_t sdo_subindex, uint32_t value)
int ecrt_slave_pdo_size (ec_slave_t *slave, uint16_t pdo_index, uint8_t pdo_subindex, size_t size)

Variables

const ec_code_msg_t al_status_messages []
 Application layer status messages.


Function Documentation

void ec_slave_clear struct kobject *  kobj  ) 
 

Clear and free slave.

This method is called by the kobject, once there are no more references to it.

Parameters:
kobj  kobject of the slave

Definition at line 237 of file slave.c.

void ec_slave_sdos_clear struct kobject *   ) 
 

Parameters:
kobj  kobject for SDOs

Definition at line 298 of file slave.c.

ssize_t ec_show_slave_attribute struct kobject *  kobj,
struct attribute *  attr,
char *  buffer
 

Formats attribute data for SysFS read access.

Returns:
number of bytes to read
Parameters:
kobj  slave's kobject
attr  attribute
buffer  memory to store data

Definition at line 853 of file slave.c.

ssize_t ec_store_slave_attribute struct kobject *  kobj,
struct attribute *  attr,
const char *  buffer,
size_t  size
 

Formats attribute data for SysFS write access.

Returns:
number of bytes processed, or negative error code
Parameters:
kobj  slave's kobject
attr  attribute
buffer  memory with data
size  size of data to store

Definition at line 901 of file slave.c.

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.

void ec_slave_reset ec_slave_t slave  ) 
 

Reset slave from operation mode.

Parameters:
slave  EtherCAT slave

Definition at line 308 of file slave.c.

void ec_slave_request_state ec_slave_t slave,
ec_slave_state_t  state
 

Parameters:
slave  ETherCAT slave
state  new state

Definition at line 334 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.

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.

size_t ec_slave_info const ec_slave_t slave,
char *  buffer
 

Outputs all information about a certain slave.

Parameters:
slave  EtherCAT slave
buffer  Output buffer

Definition at line 608 of file slave.c.

ssize_t ec_slave_write_eeprom ec_slave_t slave,
const uint8_t *  data,
size_t  size
 

Schedules an EEPROM write operation.

Returns:
0 in case of success, else < 0
Parameters:
slave  EtherCAT slave
data  new EEPROM data
size  size of data in bytes

Definition at line 776 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_conf_sdo ec_slave_t slave,
uint16_t  sdo_index,
uint8_t  sdo_subindex,
const uint8_t *  data,
size_t  size
 

Returns:
0 in case of success, else < 0
Parameters:
slave  EtherCAT slave
sdo_index  SDO index
sdo_subindex  SDO subindex
data  SDO data
size  SDO size in bytes

Definition at line 1005 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.

void ec_slave_sdo_dict_info const ec_slave_t slave,
unsigned int *  sdo_count,
unsigned int *  entry_count
 

Counts the total number of SDOs and entries in the dictionary.

Parameters:
slave  EtherCAT slave
sdo_count  number of SDOs
entry_count  total number of entries

Definition at line 1067 of file slave.c.


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