IgH EtherCAT Master  1.6.0
EtherCAT Real Time Application Interface

Interface to interact with the EtherCAT master with real time contraints. More...

Functions

EC_PUBLIC_API int ecrt_master_send (ec_master_t *master)
 Sends all datagrams in the queue. More...
 
EC_PUBLIC_API int ecrt_master_receive (ec_master_t *master)
 Fetches received frames from the hardware and processes the datagrams. More...
 
EC_PUBLIC_API int ecrt_master_application_time (ec_master_t *master, uint64_t app_time)
 Sets the application time. More...
 
EC_PUBLIC_API int ecrt_master_sync_reference_clock (ec_master_t *master)
 Queues the DC reference clock drift compensation datagram for sending. More...
 
EC_PUBLIC_API int ecrt_master_sync_reference_clock_to (ec_master_t *master, uint64_t sync_time)
 Queues the DC reference clock drift compensation datagram for sending. More...
 
EC_PUBLIC_API int ecrt_master_sync_slave_clocks (ec_master_t *master)
 Queues the DC clock drift compensation datagram for sending. More...
 
EC_PUBLIC_API int ecrt_master_sync_monitor_queue (ec_master_t *master)
 Queues the DC synchrony monitoring datagram for sending. More...
 
EC_PUBLIC_API uint32_t ecrt_master_sync_monitor_process (const ec_master_t *master)
 Processes the DC synchrony monitoring datagram. More...
 
EC_PUBLIC_API int ecrt_master_reset (ec_master_t *master)
 Retry configuring slaves. More...
 
EC_PUBLIC_API int ecrt_slave_config_emerg_pop (ec_slave_config_t *sc, uint8_t *target)
 Read and remove one record from the CoE emergency ring buffer. More...
 
EC_PUBLIC_API int ecrt_slave_config_emerg_clear (ec_slave_config_t *sc)
 Clears CoE emergency ring buffer and the overrun counter. More...
 
EC_PUBLIC_API int ecrt_slave_config_emerg_overruns (const ec_slave_config_t *sc)
 Read the number of CoE emergency overruns. More...
 
EC_PUBLIC_API int ecrt_slave_config_state (const ec_slave_config_t *sc, ec_slave_config_state_t *state)
 Outputs the state of the slave configuration. More...
 
EC_PUBLIC_API int ecrt_domain_process (ec_domain_t *domain)
 Determines the states of the domain's datagrams. More...
 
EC_PUBLIC_API int ecrt_domain_queue (ec_domain_t *domain)
 (Re-)queues all domain datagrams in the master's datagram queue. More...
 
EC_PUBLIC_API int ecrt_domain_state (const ec_domain_t *domain, ec_domain_state_t *state)
 Reads the state of a domain. More...
 
EC_PUBLIC_API int ecrt_sdo_request_index (ec_sdo_request_t *req, uint16_t index, uint8_t subindex)
 Set the SDO index and subindex. More...
 
EC_PUBLIC_API uint8_t * ecrt_sdo_request_data (const ec_sdo_request_t *req)
 Access to the SDO request's data. More...
 
EC_PUBLIC_API size_t ecrt_sdo_request_data_size (const ec_sdo_request_t *req)
 Returns the current SDO data size. More...
 
ec_request_state_t ecrt_sdo_request_state (const ec_sdo_request_t *req)
 Get the current state of the SDO request. More...
 
EC_PUBLIC_API int ecrt_sdo_request_write (ec_sdo_request_t *req)
 Schedule an SDO write operation. More...
 
EC_PUBLIC_API int ecrt_sdo_request_read (ec_sdo_request_t *req)
 Schedule an SDO read operation. More...
 
EC_PUBLIC_API int ecrt_soe_request_idn (ec_soe_request_t *req, uint8_t drive_no, uint16_t idn)
 Set the request's drive and Sercos ID numbers. More...
 
EC_PUBLIC_API uint8_t * ecrt_soe_request_data (const ec_soe_request_t *req)
 Access to the SoE request's data. More...
 
EC_PUBLIC_API ec_request_state_t ecrt_soe_request_state (const ec_soe_request_t *req)
 Get the current state of the SoE request. More...
 
EC_PUBLIC_API int ecrt_soe_request_write (ec_soe_request_t *req)
 Schedule an SoE IDN write operation. More...
 
EC_PUBLIC_API int ecrt_soe_request_read (ec_soe_request_t *req)
 Schedule an SoE IDN read operation. More...
 
EC_PUBLIC_API int ecrt_voe_handler_send_header (ec_voe_handler_t *voe, uint32_t vendor_id, uint16_t vendor_type)
 Sets the VoE header for future send operations. More...
 
EC_PUBLIC_API int ecrt_voe_handler_received_header (const ec_voe_handler_t *voe, uint32_t *vendor_id, uint16_t *vendor_type)
 Reads the header data of a received VoE message. More...
 
EC_PUBLIC_API int ecrt_voe_handler_write (ec_voe_handler_t *voe, size_t size)
 Start a VoE write operation. More...
 
EC_PUBLIC_API int ecrt_voe_handler_read (ec_voe_handler_t *voe)
 Start a VoE read operation. More...
 
EC_PUBLIC_API int ecrt_voe_handler_read_nosync (ec_voe_handler_t *voe)
 Start a VoE read operation without querying the sync manager status. More...
 
EC_PUBLIC_API ec_request_state_t ecrt_voe_handler_execute (ec_voe_handler_t *voe)
 Execute the handler. More...
 
EC_PUBLIC_API uint8_t * ecrt_reg_request_data (const ec_reg_request_t *req)
 Access to the register request's data. More...
 
ec_request_state_t ecrt_reg_request_state (const ec_reg_request_t *req)
 Get the current state of the register request. More...
 
EC_PUBLIC_API int ecrt_reg_request_write (ec_reg_request_t *req, uint16_t address, size_t size)
 Schedule an register write operation. More...
 
EC_PUBLIC_API int ecrt_reg_request_read (ec_reg_request_t *req, uint16_t address, size_t size)
 Schedule a register read operation. More...
 

Detailed Description

Interface to interact with the EtherCAT master with real time contraints.

After configuring the EtherCAT master, the application switches to the operational mode by calling ecrt_master_activate(). In operational mode, do not call other methods than these listed in this group. Many of the methods in EtherCAT Configuration Interface are blocking, calling these in operational mode will result in a deadlock.

Function Documentation

◆ ecrt_master_send()

EC_PUBLIC_API int ecrt_master_send ( ec_master_t master)

Sends all datagrams in the queue.

This method takes all datagrams, that have been queued for transmission, puts them into frames, and passes them to the Ethernet device for sending.

Has to be called cyclically by the application after ecrt_master_activate() has returned.

Returns
Zero on success, otherwise negative error code.
Parameters
masterEtherCAT master.

Definition at line 2424 of file master.c.

◆ ecrt_master_receive()

EC_PUBLIC_API int ecrt_master_receive ( ec_master_t master)

Fetches received frames from the hardware and processes the datagrams.

Queries the network device for received frames by calling the interrupt service routine. Extracts received datagrams and dispatches the results to the datagram objects in the queue. Received datagrams, and the ones that timed out, will be marked, and dequeued.

Has to be called cyclically by the realtime application after ecrt_master_activate() has returned.

Returns
Zero on success, otherwise negative error code.
Parameters
masterEtherCAT master.

Definition at line 2469 of file master.c.

◆ ecrt_master_application_time()

EC_PUBLIC_API int ecrt_master_application_time ( ec_master_t master,
uint64_t  app_time 
)

Sets the application time.

The master has to know the application's time when operating slaves with distributed clocks. The time is not incremented by the master itself, so this method has to be called cyclically.

Attention
The time passed to this method is used to calculate the phase of the slaves' SYNC0/1 interrupts. It should be called constantly at the same point of the realtime cycle. So it is recommended to call it at the start of the calculations to avoid deviancies due to changing execution times.

The time is used when setting the slaves' System Time Offset and Cyclic Operation Start Time registers and when synchronizing the DC reference clock to the application time via ecrt_master_sync_reference_clock().

The time is defined as nanoseconds from 2000-01-01 00:00. Converting an epoch time can be done with the EC_TIMEVAL2NANO() macro, but is not necessary, since the absolute value is not of any interest.

Returns
Zero on success, otherwise negative error code.
Parameters
masterEtherCAT master.
app_timeApplication time.

Definition at line 2773 of file master.c.

◆ ecrt_master_sync_reference_clock()

EC_PUBLIC_API int ecrt_master_sync_reference_clock ( ec_master_t master)

Queues the DC reference clock drift compensation datagram for sending.

The reference clock will by synchronized to the application time provided by the last call off ecrt_master_application_time().

Returns
Zero on success, otherwise negative error code.
Return values
0Success.
-ENXIONo reference clock found.
Parameters
masterEtherCAT master.

Definition at line 2805 of file master.c.

◆ ecrt_master_sync_reference_clock_to()

EC_PUBLIC_API int ecrt_master_sync_reference_clock_to ( ec_master_t master,
uint64_t  sync_time 
)

Queues the DC reference clock drift compensation datagram for sending.

The reference clock will by synchronized to the time passed in the sync_time parameter.

Has to be called by the application after ecrt_master_activate() has returned.

Returns
Zero on success, otherwise negative error code.
Return values
0Success.
-ENXIONo reference clock found.
Parameters
masterEtherCAT master.
sync_timeSync reference clock to this time.

Definition at line 2818 of file master.c.

◆ ecrt_master_sync_slave_clocks()

EC_PUBLIC_API int ecrt_master_sync_slave_clocks ( ec_master_t master)

Queues the DC clock drift compensation datagram for sending.

All slave clocks synchronized to the reference clock.

Has to be called by the application after ecrt_master_activate() has returned.

Returns
0 on success, otherwise negative error code.
Return values
0Success.
-ENXIONo reference clock found.
Parameters
masterEtherCAT master.

Definition at line 2834 of file master.c.

◆ ecrt_master_sync_monitor_queue()

EC_PUBLIC_API int ecrt_master_sync_monitor_queue ( ec_master_t master)

Queues the DC synchrony monitoring datagram for sending.

The datagram broadcast-reads all "System time difference" registers (0x092c) to get an upper estimation of the DC synchrony. The result can be checked with the ecrt_master_sync_monitor_process() method.

Parameters
masterEtherCAT master.

Definition at line 2847 of file master.c.

◆ ecrt_master_sync_monitor_process()

EC_PUBLIC_API uint32_t ecrt_master_sync_monitor_process ( const ec_master_t master)

Processes the DC synchrony monitoring datagram.

If the sync monitoring datagram was sent before with ecrt_master_sync_monitor_queue(), the result can be queried with this method.

Returns
Upper estimation of the maximum time difference in ns.
Parameters
masterEtherCAT master.

Definition at line 2856 of file master.c.

◆ ecrt_master_reset()

EC_PUBLIC_API int ecrt_master_reset ( ec_master_t master)

Retry configuring slaves.

Via this method, the application can tell the master to bring all slaves to OP state. In general, this is not necessary, because it is automatically done by the master. But with special slaves, that can be reconfigured by the vendor during runtime, it can be useful.

Calling this method only makes sense in realtime context (after activation), because slaves will not be configured before.

Returns
0 on success, otherwise negative error code.
Parameters
masterEtherCAT master.

Definition at line 3270 of file master.c.

◆ ecrt_slave_config_emerg_pop()

EC_PUBLIC_API int ecrt_slave_config_emerg_pop ( ec_slave_config_t sc,
uint8_t *  target 
)

Read and remove one record from the CoE emergency ring buffer.

A record consists of 8 bytes:

Byte 0-1: Error code (little endian) Byte 2: Error register Byte 3-7: Data

Calling this method makes only sense in realtime context (after master activation).

Returns
0 on success (record popped), or negative error code (i. e. -ENOENT, if ring is empty).
Parameters
scSlave configuration.
targetPointer to target memory (at least EC_COE_EMERGENCY_MSG_SIZE bytes).

Definition at line 1114 of file slave_config.c.

◆ ecrt_slave_config_emerg_clear()

EC_PUBLIC_API int ecrt_slave_config_emerg_clear ( ec_slave_config_t sc)

Clears CoE emergency ring buffer and the overrun counter.

Calling this method makes only sense in realtime context (after master activation).

Returns
0 on success, or negative error code.
Parameters
scSlave configuration.

Definition at line 1121 of file slave_config.c.

◆ ecrt_slave_config_emerg_overruns()

EC_PUBLIC_API int ecrt_slave_config_emerg_overruns ( const ec_slave_config_t sc)

Read the number of CoE emergency overruns.

The overrun counter will be incremented when a CoE emergency message could not be stored in the ring buffer and had to be dropped. Call ecrt_slave_config_emerg_clear() to reset the counter.

Calling this method makes only sense in realtime context (after master activation).

Returns
Number of overruns since last clear, or negative error code.
Parameters
scSlave configuration.

Definition at line 1128 of file slave_config.c.

◆ ecrt_slave_config_state()

EC_PUBLIC_API int ecrt_slave_config_state ( const ec_slave_config_t sc,
ec_slave_config_state_t state 
)

Outputs the state of the slave configuration.

Stores the state information in the given state structure. The state information is updated by the master state machine, so it may take a few cycles, until it changes.

Attention
If the state of process data exchange shall be monitored in realtime, ecrt_domain_state() should be used.

This method is meant to be called in realtime context (after master activation).

Parameters
scSlave configuration
stateState object to write to.

Definition at line 1324 of file slave_config.c.

◆ ecrt_domain_process()

EC_PUBLIC_API int ecrt_domain_process ( ec_domain_t domain)

Determines the states of the domain's datagrams.

Evaluates the working counters of the received datagrams and outputs statistics, if necessary. This must be called after ecrt_master_receive() is expected to receive the domain datagrams in order to make ecrt_domain_state() return the result of the last process data exchange.

Returns
0 on success, otherwise negative error code.
Parameters
domainDomain.

Definition at line 450 of file domain.c.

◆ ecrt_domain_queue()

EC_PUBLIC_API int ecrt_domain_queue ( ec_domain_t domain)

(Re-)queues all domain datagrams in the master's datagram queue.

Call this function to mark the domain's datagrams for exchanging at the next call of ecrt_master_send().

Returns
0 on success, otherwise negative error code.
Parameters
domainDomain.

Definition at line 641 of file domain.c.

◆ ecrt_domain_state()

EC_PUBLIC_API int ecrt_domain_state ( const ec_domain_t domain,
ec_domain_state_t state 
)

Reads the state of a domain.

Stores the domain state in the given state structure.

Using this method, the process data exchange can be monitored in realtime.

Returns
0 on success, otherwise negative error code.
Parameters
domainDomain.
statePointer to a state object to store the information.

Definition at line 672 of file domain.c.

◆ ecrt_sdo_request_index()

EC_PUBLIC_API int ecrt_sdo_request_index ( ec_sdo_request_t req,
uint16_t  index,
uint8_t  subindex 
)

Set the SDO index and subindex.

Attention
If the SDO index and/or subindex is changed while ecrt_sdo_request_state() returns EC_REQUEST_BUSY, this may lead to unexpected results.

This method is meant to be called in realtime context (after master activation). To initialize the SDO request, the index and subindex can be set via ecrt_slave_config_create_sdo_request().

Returns
0 on success, otherwise negative error code.
Parameters
reqSDO request.
indexSDO index.
subindexSDO subindex.

Definition at line 181 of file sdo_request.c.

◆ ecrt_sdo_request_data()

EC_PUBLIC_API uint8_t* ecrt_sdo_request_data ( const ec_sdo_request_t req)

Access to the SDO request's data.

This function returns a pointer to the request's internal SDO data memory.

Attention
The return value can be invalid during a read operation, because the internal SDO data memory could be re-allocated if the read SDO data do not fit inside.

This method is meant to be called in realtime context (after master activation), but can also be used to initialize data before.

Returns
Pointer to the internal SDO data memory.
Parameters
reqSDO request.

Definition at line 199 of file sdo_request.c.

◆ ecrt_sdo_request_data_size()

EC_PUBLIC_API size_t ecrt_sdo_request_data_size ( const ec_sdo_request_t req)

Returns the current SDO data size.

When the SDO request is created, the data size is set to the size of the reserved memory. After a read operation the size is set to the size of the read data. The size is not modified in any other situation.

This method is meant to be called in realtime context (after master activation).

Returns
SDO data size in bytes.
Parameters
reqSDO request.

Definition at line 206 of file sdo_request.c.

◆ ecrt_sdo_request_state()

ec_request_state_t ecrt_sdo_request_state ( const ec_sdo_request_t req)

Get the current state of the SDO request.

The user-space implementation fetches incoming data and stores the received data size in the request object, so the request is not const.

This method is meant to be called in realtime context (after master activation).

Returns
Request state.
Parameters
reqSDO request.

Definition at line 213 of file sdo_request.c.

◆ ecrt_sdo_request_write()

EC_PUBLIC_API int ecrt_sdo_request_write ( ec_sdo_request_t req)

Schedule an SDO write operation.

Attention
This method may not be called while ecrt_sdo_request_state() returns EC_REQUEST_BUSY.

This method is meant to be called in realtime context (after master activation).

Returns
0 on success, otherwise negative error code.
Return values
-EINVALInvalid input data, e.g. data size == 0.
-ENOBUFSReserved memory in ecrt_slave_config_create_sdo_request() too small.
Parameters
reqSDO request.

Definition at line 232 of file sdo_request.c.

◆ ecrt_sdo_request_read()

EC_PUBLIC_API int ecrt_sdo_request_read ( ec_sdo_request_t req)

Schedule an SDO read operation.

Attention
This method may not be called while ecrt_sdo_request_state() returns EC_REQUEST_BUSY.
After calling this function, the return value of ecrt_sdo_request_data() must be considered as invalid while ecrt_sdo_request_state() returns EC_REQUEST_BUSY.

This method is meant to be called in realtime context (after master activation).

Returns
0 on success, otherwise negative error code.
Parameters
reqSDO request.

Definition at line 220 of file sdo_request.c.

◆ ecrt_soe_request_idn()

EC_PUBLIC_API int ecrt_soe_request_idn ( ec_soe_request_t req,
uint8_t  drive_no,
uint16_t  idn 
)

Set the request's drive and Sercos ID numbers.

Attention
If the drive number and/or IDN is changed while ecrt_soe_request_state() returns EC_REQUEST_BUSY, this may lead to unexpected results.

This method is meant to be called in realtime context (after master activation). To initialize the SoE request, the drive_no and IDN can be set via ecrt_slave_config_create_soe_request().

Returns
0 on success, otherwise negative error code.
Parameters
reqIDN request.
drive_noSDO index.
idnSoE IDN.

Definition at line 268 of file soe_request.c.

◆ ecrt_soe_request_data()

EC_PUBLIC_API uint8_t* ecrt_soe_request_data ( const ec_soe_request_t req)

Access to the SoE request's data.

This function returns a pointer to the request's internal IDN data memory.

Attention
The return value can be invalidated during a read operation, because the internal IDN data memory could be re-allocated if the read IDN data do not fit inside.

This method is meant to be called in realtime context (after master activation), but can also be used to initialize data before.

Returns
Pointer to the internal IDN data memory.
Parameters
reqSoE request.

Definition at line 286 of file soe_request.c.

◆ ecrt_soe_request_state()

EC_PUBLIC_API ec_request_state_t ecrt_soe_request_state ( const ec_soe_request_t req)

Get the current state of the SoE request.

Returns
Request state.

This method is meant to be called in realtime context (after master activation).

In the user-space implementation, the method fetches the size of the incoming data, so the request object is not const.

Parameters
reqSoE request.

Definition at line 300 of file soe_request.c.

◆ ecrt_soe_request_write()

EC_PUBLIC_API int ecrt_soe_request_write ( ec_soe_request_t req)

Schedule an SoE IDN write operation.

Attention
This method may not be called while ecrt_soe_request_state() returns EC_REQUEST_BUSY.

This method is meant to be called in realtime context (after master activation).

Returns
0 on success, otherwise negative error code.
Return values
-EINVALInvalid input data, e.g. data size == 0.
-ENOBUFSReserved memory in ecrt_slave_config_create_soe_request() too small.
Parameters
reqSoE request.

Definition at line 314 of file soe_request.c.

◆ ecrt_soe_request_read()

EC_PUBLIC_API int ecrt_soe_request_read ( ec_soe_request_t req)

Schedule an SoE IDN read operation.

Attention
This method may not be called while ecrt_soe_request_state() returns EC_REQUEST_BUSY.
After calling this function, the return value of ecrt_soe_request_data() must be considered as invalid while ecrt_soe_request_state() returns EC_REQUEST_BUSY.

This method is meant to be called in realtime context (after master activation).

Returns
0 on success, otherwise negative error code.
Parameters
reqSoE request.

Definition at line 307 of file soe_request.c.

◆ ecrt_voe_handler_send_header()

EC_PUBLIC_API int ecrt_voe_handler_send_header ( ec_voe_handler_t voe,
uint32_t  vendor_id,
uint16_t  vendor_type 
)

Sets the VoE header for future send operations.

A VoE message shall contain a 4-byte vendor ID, followed by a 2-byte vendor type at as header. These numbers can be set with this function. The values are valid and will be used for future send operations until the next call of this method.

This method is meant to be called in non-realtime context (before master activation) to initialize the header data, but it is also safe to change the header later on in realtime context.

Returns
0 on success, otherwise negative error code.
Parameters
voeVoE handler.
vendor_idVendor ID.
vendor_typeVendor-specific type.

Definition at line 115 of file voe_handler.c.

◆ ecrt_voe_handler_received_header()

EC_PUBLIC_API int ecrt_voe_handler_received_header ( const ec_voe_handler_t voe,
uint32_t *  vendor_id,
uint16_t *  vendor_type 
)

Reads the header data of a received VoE message.

This method can be used to get the received VoE header information after a read operation has succeeded.

The header information is stored at the memory given by the pointer parameters.

This method is meant to be called in realtime context (after master activation).

Returns
0 on success, otherwise negative error code.
Parameters
voeVoE handler.
vendor_idVendor ID.
vendor_typeVendor-specific type.

Definition at line 125 of file voe_handler.c.

◆ ecrt_voe_handler_write()

EC_PUBLIC_API int ecrt_voe_handler_write ( ec_voe_handler_t voe,
size_t  size 
)

Start a VoE write operation.

After this function has been called, the ecrt_voe_handler_execute() method must be called in every realtime cycle as long as it returns EC_REQUEST_BUSY. No other operation may be started while the handler is busy.

This method is meant to be called in realtime context (after master activation).

Returns
0 on success, otherwise negative error code.
Return values
-ENOBUFSReserved memory in ecrt_slave_config_create_voe_handler too small.
Parameters
voeVoE handler.
sizeNumber of bytes to write (without the VoE header).

Definition at line 173 of file voe_handler.c.

◆ ecrt_voe_handler_read()

EC_PUBLIC_API int ecrt_voe_handler_read ( ec_voe_handler_t voe)

Start a VoE read operation.

After this function has been called, the ecrt_voe_handler_execute() method must be called in every realtime cycle as long as it returns EC_REQUEST_BUSY. No other operation may be started while the handler is busy.

The state machine queries the slave's send mailbox for new data to be send to the master. If no data appear within the EC_VOE_RESPONSE_TIMEOUT (defined in master/voe_handler.c), the operation fails.

On success, the size of the read data can be determined via ecrt_voe_handler_data_size(), while the VoE header of the received data can be retrieved with ecrt_voe_handler_received_header().

This method is meant to be called in realtime context (after master activation).

Returns
0 on success, otherwise negative error code.
Parameters
voeVoE handler.

Definition at line 153 of file voe_handler.c.

◆ ecrt_voe_handler_read_nosync()

EC_PUBLIC_API int ecrt_voe_handler_read_nosync ( ec_voe_handler_t voe)

Start a VoE read operation without querying the sync manager status.

After this function has been called, the ecrt_voe_handler_execute() method must be called in every realtime cycle as long as it returns EC_REQUEST_BUSY. No other operation may be started while the handler is busy.

The state machine queries the slave by sending an empty mailbox. The slave fills its data to the master in this mailbox. If no data appear within the EC_VOE_RESPONSE_TIMEOUT (defined in master/voe_handler.c), the operation fails.

On success, the size of the read data can be determined via ecrt_voe_handler_data_size(), while the VoE header of the received data can be retrieved with ecrt_voe_handler_received_header().

This method is meant to be called in realtime context (after master activation).

Returns
0 on success, otherwise negative error code.
Parameters
voeVoE handler.

Definition at line 163 of file voe_handler.c.

◆ ecrt_voe_handler_execute()

EC_PUBLIC_API ec_request_state_t ecrt_voe_handler_execute ( ec_voe_handler_t voe)

Execute the handler.

This method executes the VoE handler. It has to be called in every realtime cycle as long as it returns EC_REQUEST_BUSY.

Returns
Handler state.

This method is meant to be called in realtime context (after master activation).

Parameters
voeVoE handler.

Definition at line 184 of file voe_handler.c.

◆ ecrt_reg_request_data()

EC_PUBLIC_API uint8_t* ecrt_reg_request_data ( const ec_reg_request_t req)

Access to the register request's data.

This function returns a pointer to the request's internal memory.

  • After a read operation was successful, integer data can be evaluated using the EC_READ_*() macros as usual. Example:
    uint16_t value = EC_READ_U16(ecrt_reg_request_data(reg_request)));
  • If a write operation shall be triggered, the data have to be written to the internal memory. Use the EC_WRITE_*() macros, if you are writing integer data. Be sure, that the data fit into the memory. The memory size is a parameter of ecrt_slave_config_create_reg_request().
    EC_WRITE_U16(ecrt_reg_request_data(reg_request), 0xFFFF);

This method is meant to be called in realtime context (after master activation), but can also be used to initialize data before.

Returns
Pointer to the internal memory.
Parameters
reqRegister request.

Definition at line 78 of file reg_request.c.

◆ ecrt_reg_request_state()

ec_request_state_t ecrt_reg_request_state ( const ec_reg_request_t req)

Get the current state of the register request.

This method is meant to be called in realtime context (after master activation).

Returns
Request state.
Parameters
reqRegister request.

Definition at line 85 of file reg_request.c.

◆ ecrt_reg_request_write()

EC_PUBLIC_API int ecrt_reg_request_write ( ec_reg_request_t req,
uint16_t  address,
size_t  size 
)

Schedule an register write operation.

Attention
This method may not be called while ecrt_reg_request_state() returns EC_REQUEST_BUSY.
The size parameter is truncated to the size given at request creation.

This method is meant to be called in realtime context (after master activation).

Returns
0 on success, otherwise negative error code.
Return values
-ENOBUFSReserved memory in ecrt_slave_config_create_reg_request too small.
Parameters
reqRegister request.
addressRegister address.
sizeSize to write.

Definition at line 92 of file reg_request.c.

◆ ecrt_reg_request_read()

EC_PUBLIC_API int ecrt_reg_request_read ( ec_reg_request_t req,
uint16_t  address,
size_t  size 
)

Schedule a register read operation.

Attention
This method may not be called while ecrt_reg_request_state() returns EC_REQUEST_BUSY.
The size parameter is truncated to the size given at request creation.

This method is meant to be called in realtime context (after master activation).

Returns
0 on success, otherwise negative error code.
Return values
-ENOBUFSReserved memory in ecrt_slave_config_create_reg_request too small.
Parameters
reqRegister request.
addressRegister address.
sizeSize to write.

Definition at line 104 of file reg_request.c.