ecrt.h File Reference


Detailed Description

EtherCAT realtime interface.

Definition in file ecrt.h.

Go to the source code of this file.

Data Structures

struct  ec_field_init_t
 Initialization type for field registrations. More...

Defines

#define EC_READ_BIT(DATA, POS)   ((*((uint8_t *) (DATA)) >> (POS)) & 0x01)
 Read a certain bit of an EtherCAT data byte.
#define EC_WRITE_BIT(DATA, POS, VAL)
 Write a certain bit of an EtherCAT data byte.
#define EC_READ_U8(DATA)   ((uint8_t) *((uint8_t *) (DATA)))
 Read an 8-bit unsigned value from EtherCAT data.
#define EC_READ_S8(DATA)   ((int8_t) *((uint8_t *) (DATA)))
 Read an 8-bit signed value from EtherCAT data.
#define EC_READ_U16(DATA)   ((uint16_t) le16_to_cpup((void *) (DATA)))
 Read a 16-bit unsigned value from EtherCAT data.
#define EC_READ_S16(DATA)   ((int16_t) le16_to_cpup((void *) (DATA)))
 Read a 16-bit signed value from EtherCAT data.
#define EC_READ_U32(DATA)   ((uint32_t) le32_to_cpup((void *) (DATA)))
 Read a 32-bit unsigned value from EtherCAT data.
#define EC_READ_S32(DATA)   ((int32_t) le32_to_cpup((void *) (DATA)))
 Read a 32-bit signed value from EtherCAT data.
#define EC_WRITE_U8(DATA, VAL)
 Write an 8-bit unsigned value to EtherCAT data.
#define EC_WRITE_S8(DATA, VAL)   EC_WRITE_U8(DATA, VAL)
 Write an 8-bit signed value to EtherCAT data.
#define EC_WRITE_U16(DATA, VAL)
 Write a 16-bit unsigned value to EtherCAT data.
#define EC_WRITE_S16(DATA, VAL)   EC_WRITE_U16(DATA, VAL)
 Write a 16-bit signed value to EtherCAT data.
#define EC_WRITE_U32(DATA, VAL)
 Write a 32-bit unsigned value to EtherCAT data.
#define EC_WRITE_S32(DATA, VAL)   EC_WRITE_U32(DATA, VAL)
 Write a 32-bit signed value to EtherCAT data.

Typedefs

typedef ec_master ec_master_t
typedef ec_domain ec_domain_t
typedef ec_slave ec_slave_t

Functions

ec_master_tecrt_request_master (unsigned int master_index)
 Reserves an EtherCAT master for realtime operation.
void ecrt_release_master (ec_master_t *master)
 Releases a reserved EtherCAT master.
void ecrt_master_callbacks (ec_master_t *master, int(*request_cb)(void *), void(*release_cb)(void *), void *cb_data)
 Sets the locking callbacks.
ec_domain_tecrt_master_create_domain (ec_master_t *master)
 Creates a domain.
int ecrt_master_activate (ec_master_t *master)
 Configures all slaves and leads them to the OP state.
void ecrt_master_deactivate (ec_master_t *master)
 Resets all slaves to INIT state.
int ecrt_master_fetch_sdo_lists (ec_master_t *master)
 Fetches the SDO dictionaries of all slaves.
void ecrt_master_sync_io (ec_master_t *master)
 Sends queued datagrams and waits for their reception.
void ecrt_master_async_send (ec_master_t *master)
 Asynchronous sending of datagrams.
void ecrt_master_async_receive (ec_master_t *master)
 Asynchronous receiving of datagrams.
void ecrt_master_prepare_async_io (ec_master_t *master)
 Prepares synchronous IO.
void ecrt_master_run (ec_master_t *master)
 Does all cyclic master work.
int ecrt_master_start_eoe (ec_master_t *master)
 Starts Ethernet-over-EtherCAT processing for all EoE-capable slaves.
void ecrt_master_debug (ec_master_t *master, int level)
 Sets the debug level of the master.
void ecrt_master_print (const ec_master_t *master, unsigned int verbosity)
 Outputs all master information.
ec_slave_tecrt_master_get_slave (const ec_master_t *, const char *)
 Translates an ASCII coded bus-address to a slave pointer.
ec_slave_tecrt_domain_register_field (ec_domain_t *domain, const char *address, const char *vendor_name, const char *product_name, void **data_ptr, const char *field_name, unsigned int field_index, unsigned int field_count)
 Registers a data field in a domain.
int ecrt_domain_register_field_list (ec_domain_t *domain, const ec_field_init_t *fields)
 Registeres a bunch of data fields.
void ecrt_domain_queue (ec_domain_t *domain)
 Places all process data datagrams in the masters datagram queue.
void ecrt_domain_process (ec_domain_t *domain)
 Processes received process data.
int ecrt_domain_state (ec_domain_t *domain)
 Returns the state of a domain.
int ecrt_slave_sdo_read_exp8 (ec_slave_t *slave, uint16_t sdo_index, uint8_t sdo_subindex, uint8_t *value)
 Reads an 8-bit SDO in expedited mode.
int ecrt_slave_sdo_read_exp16 (ec_slave_t *slave, uint16_t sdo_index, uint8_t sdo_subindex, uint16_t *value)
 Reads a 16-bit SDO in expedited mode.
int ecrt_slave_sdo_read_exp32 (ec_slave_t *slave, uint16_t sdo_index, uint8_t sdo_subindex, uint32_t *value)
 Reads a 32-bit SDO in expedited mode.
int ecrt_slave_sdo_write_exp8 (ec_slave_t *slave, uint16_t sdo_index, uint8_t sdo_subindex, uint8_t value)
 Writes an 8-bit SDO in expedited mode.
int ecrt_slave_sdo_write_exp16 (ec_slave_t *slave, uint16_t sdo_index, uint8_t sdo_subindex, uint16_t value)
 Writes a 16-bit SDO in expedited mode.
int ecrt_slave_sdo_write_exp32 (ec_slave_t *slave, uint16_t sdo_index, uint8_t sdo_subindex, uint32_t value)
 Writes a 32-bit SDO in expedited mode.
int ecrt_slave_sdo_read (ec_slave_t *slave, uint16_t sdo_index, uint8_t sdo_subindex, uint8_t *data, size_t *size)
 Reads a CANopen SDO in normal mode.
int ecrt_slave_write_alias (ec_slave_t *slave, uint16_t alias)
 Writes the "configured station alias" to the slave's EEPROM.
int ecrt_slave_field_size (ec_slave_t *slave, const char *field_name, unsigned int field_index, size_t size)


Define Documentation

#define EC_READ_BIT DATA,
POS   )     ((*((uint8_t *) (DATA)) >> (POS)) & 0x01)
 

Read a certain bit of an EtherCAT data byte.

Parameters:
DATA EtherCAT data pointer
POS bit position

Definition at line 180 of file ecrt.h.

#define EC_WRITE_BIT DATA,
POS,
VAL   ) 
 

Value:

do { \
        if (VAL) *((uint8_t *) (DATA)) |=  (1 << (POS)); \
        else     *((uint8_t *) (DATA)) &= ~(1 << (POS)); \
    } while (0)
Write a certain bit of an EtherCAT data byte.

Parameters:
DATA EtherCAT data pointer
POS bit position
VAL new bit value

Definition at line 189 of file ecrt.h.

#define EC_READ_U8 DATA   )     ((uint8_t) *((uint8_t *) (DATA)))
 

Read an 8-bit unsigned value from EtherCAT data.

Returns:
EtherCAT data value

Definition at line 204 of file ecrt.h.

#define EC_READ_S8 DATA   )     ((int8_t) *((uint8_t *) (DATA)))
 

Read an 8-bit signed value from EtherCAT data.

Parameters:
DATA EtherCAT data pointer
Returns:
EtherCAT data value

Definition at line 213 of file ecrt.h.

#define EC_READ_U16 DATA   )     ((uint16_t) le16_to_cpup((void *) (DATA)))
 

Read a 16-bit unsigned value from EtherCAT data.

Parameters:
DATA EtherCAT data pointer
Returns:
EtherCAT data value

Definition at line 222 of file ecrt.h.

#define EC_READ_S16 DATA   )     ((int16_t) le16_to_cpup((void *) (DATA)))
 

Read a 16-bit signed value from EtherCAT data.

Parameters:
DATA EtherCAT data pointer
Returns:
EtherCAT data value

Definition at line 231 of file ecrt.h.

#define EC_READ_U32 DATA   )     ((uint32_t) le32_to_cpup((void *) (DATA)))
 

Read a 32-bit unsigned value from EtherCAT data.

Parameters:
DATA EtherCAT data pointer
Returns:
EtherCAT data value

Definition at line 240 of file ecrt.h.

#define EC_READ_S32 DATA   )     ((int32_t) le32_to_cpup((void *) (DATA)))
 

Read a 32-bit signed value from EtherCAT data.

Parameters:
DATA EtherCAT data pointer
Returns:
EtherCAT data value

Definition at line 249 of file ecrt.h.

#define EC_WRITE_U8 DATA,
VAL   ) 
 

Value:

do { \
        *((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \
    } while (0)
Write an 8-bit unsigned value to EtherCAT data.

Parameters:
DATA EtherCAT data pointer
VAL new value

Definition at line 263 of file ecrt.h.

#define EC_WRITE_S8 DATA,
VAL   )     EC_WRITE_U8(DATA, VAL)
 

Write an 8-bit signed value to EtherCAT data.

Parameters:
DATA EtherCAT data pointer
VAL new value

Definition at line 274 of file ecrt.h.

#define EC_WRITE_U16 DATA,
VAL   ) 
 

Value:

do { \
        *((uint16_t *) (DATA)) = (uint16_t) (VAL); \
        cpu_to_le16s(DATA); \
    } while (0)
Write a 16-bit unsigned value to EtherCAT data.

Parameters:
DATA EtherCAT data pointer
VAL new value

Definition at line 282 of file ecrt.h.

#define EC_WRITE_S16 DATA,
VAL   )     EC_WRITE_U16(DATA, VAL)
 

Write a 16-bit signed value to EtherCAT data.

Parameters:
DATA EtherCAT data pointer
VAL new value

Definition at line 294 of file ecrt.h.

#define EC_WRITE_U32 DATA,
VAL   ) 
 

Value:

do { \
        *((uint32_t *) (DATA)) = (uint32_t) (VAL); \
        cpu_to_le16s(DATA); \
    } while (0)
Write a 32-bit unsigned value to EtherCAT data.

Parameters:
DATA EtherCAT data pointer
VAL new value

Definition at line 302 of file ecrt.h.

#define EC_WRITE_S32 DATA,
VAL   )     EC_WRITE_U32(DATA, VAL)
 

Write a 32-bit signed value to EtherCAT data.

Parameters:
DATA EtherCAT data pointer
VAL new value

Definition at line 314 of file ecrt.h.


Typedef Documentation

typedef struct ec_master ec_master_t
 

See also:
ec_master

Definition at line 63 of file ecrt.h.

typedef struct ec_domain ec_domain_t
 

See also:
ec_domain

Definition at line 66 of file ecrt.h.

typedef struct ec_slave ec_slave_t
 

See also:
ec_slave

Definition at line 69 of file ecrt.h.


Generated on Wed Aug 2 18:41:43 2006 for IgH EtherCAT master by  doxygen 1.4.6