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_pdo_reg_t
 Initialization type for PDO 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.
void ecrt_master_prepare (ec_master_t *master)
 Prepares synchronous IO.
void ecrt_master_send (ec_master_t *master)
 Asynchronous sending of datagrams.
void ecrt_master_receive (ec_master_t *master)
 Asynchronous receiving of datagrams.
void ecrt_master_run (ec_master_t *master)
 Does all cyclic master work.
ec_slave_tecrt_master_get_slave (const ec_master_t *, const char *)
 Translates an ASCII coded bus-address to a slave pointer.
int ecrt_master_state (const ec_master_t *master)
ec_slave_tecrt_domain_register_pdo (ec_domain_t *domain, const char *address, uint32_t vendor_id, uint32_t product_code, uint16_t pdo_index, uint8_t pdo_subindex, void **data_ptr)
 Registers a PDO in a domain.
int ecrt_domain_register_pdo_list (ec_domain_t *domain, const ec_pdo_reg_t *pdos)
 Registeres a bunch of data fields.
void ecrt_domain_process (ec_domain_t *domain)
 Processes received process data and requeues the domain datagram(s).
int ecrt_domain_state (const ec_domain_t *domain)
 Returns the state of a domain.
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)


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 160 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 169 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 184 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 193 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 202 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 211 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 220 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 229 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 243 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 254 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 262 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 274 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 282 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 294 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 Fri Sep 1 14:56:56 2006 for IgH EtherCAT master by  doxygen 1.4.6