Updated Doxygen documentation.

This commit is contained in:
Florian Pose 2013-02-12 15:46:43 +01:00
parent aa6740a96e
commit f6f5460485
37 changed files with 1046 additions and 198 deletions

File diff suppressed because it is too large Load Diff

View File

@ -175,15 +175,15 @@
*/
#define EC_HAVE_REG_ACCESS
/* Defined if the method ecrt_master_select_reference_clock() is available.
/** Defined if the method ecrt_master_select_reference_clock() is available.
*/
#define EC_HAVE_SELECT_REF_CLOCK
/* Defined if the method ecrt_master_reference_clock_time() is available.
/** Defined if the method ecrt_master_reference_clock_time() is available.
*/
#define EC_HAVE_REF_CLOCK_TIME
/* Defined if the method ecrt_slave_config_reg_pdo_entry_pos() is available.
/** Defined if the method ecrt_slave_config_reg_pdo_entry_pos() is available.
*/
#define EC_HAVE_REG_BY_POS
@ -1449,6 +1449,8 @@ int ecrt_slave_config_emerg_overruns(
*
* The created SDO request object is freed automatically when the master is
* released.
*
* \return New SDO request, or NULL on error.
*/
ec_sdo_request_t *ecrt_slave_config_create_sdo_request(
ec_slave_config_t *sc, /**< Slave configuration. */
@ -1466,6 +1468,8 @@ ec_sdo_request_t *ecrt_slave_config_create_sdo_request(
*
* The created VoE handler object is freed automatically when the master is
* released.
*
* \return New VoE handler, or NULL on error.
*/
ec_voe_handler_t *ecrt_slave_config_create_voe_handler(
ec_slave_config_t *sc, /**< Slave configuration. */
@ -1480,6 +1484,8 @@ ec_voe_handler_t *ecrt_slave_config_create_voe_handler(
*
* The created register request object is freed automatically when the master
* is released.
*
* \return New register request, or NULL on error.
*/
ec_reg_request_t *ecrt_slave_config_create_reg_request(
ec_slave_config_t *sc, /**< Slave configuration. */

View File

@ -222,6 +222,8 @@ long eccdev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
*
* The actual mapping will be done in the eccdev_vma_nopage() callback of the
* virtual memory area.
*
* \return Always zero (success).
*/
int eccdev_mmap(
struct file *filp,
@ -247,6 +249,8 @@ int eccdev_mmap(
*
* Called at the first access on a virtual-memory area retrieved with
* ecdev_mmap().
*
* \return Zero on success, otherwise a negative error code.
*/
static int eccdev_vma_fault(
struct vm_area_struct *vma, /**< Virtual memory area. */
@ -257,12 +261,14 @@ static int eccdev_vma_fault(
ec_cdev_priv_t *priv = (ec_cdev_priv_t *) vma->vm_private_data;
struct page *page;
if (offset >= priv->ctx.process_data_size)
if (offset >= priv->ctx.process_data_size) {
return VM_FAULT_SIGBUS;
}
page = vmalloc_to_page(priv->ctx.process_data + offset);
if (!page)
if (!page) {
return VM_FAULT_SIGBUS;
}
get_page(page);
vmf->page = page;

View File

@ -29,10 +29,9 @@
*
*****************************************************************************/
/**
\file
EtherCAT CoE emergency ring buffer methods.
*/
/** \file
* EtherCAT CoE emergency ring buffer methods.
*/
/*****************************************************************************/
@ -73,6 +72,8 @@ void ec_coe_emerg_ring_clear(
/*****************************************************************************/
/** Set the ring size.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_coe_emerg_ring_size(
ec_coe_emerg_ring_t *ring, /**< Emergency ring. */
@ -128,6 +129,8 @@ void ec_coe_emerg_ring_push(
/*****************************************************************************/
/** Remove an emergency message from the ring.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_coe_emerg_ring_pop(
ec_coe_emerg_ring_t *ring, /**< Emergency ring. */
@ -146,6 +149,8 @@ int ec_coe_emerg_ring_pop(
/*****************************************************************************/
/** Clear the ring.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_coe_emerg_ring_clear_ring(
ec_coe_emerg_ring_t *ring /**< Emergency ring. */
@ -159,6 +164,8 @@ int ec_coe_emerg_ring_clear_ring(
/*****************************************************************************/
/** Read the number of overruns.
*
* \return Number of overruns.
*/
int ec_coe_emerg_ring_overruns(
ec_coe_emerg_ring_t *ring /**< Emergency ring. */

View File

@ -44,7 +44,7 @@
/** EtherCAT CoE emergency message record.
*/
typedef struct {
u8 data[EC_COE_EMERGENCY_MSG_SIZE];
u8 data[EC_COE_EMERGENCY_MSG_SIZE]; /**< Message data. */
} ec_coe_emerg_msg_t;
/*****************************************************************************/
@ -54,12 +54,12 @@ typedef struct {
typedef struct {
ec_slave_config_t *sc; /**< Slave configuration owning the ring. */
ec_coe_emerg_msg_t *msgs;
size_t size;
ec_coe_emerg_msg_t *msgs; /**< Message ring. */
size_t size; /**< Ring size. */
unsigned int read_index;
unsigned int write_index;
unsigned int overruns;
unsigned int read_index; /**< Read index. */
unsigned int write_index; /**< Write index. */
unsigned int overruns; /**< Number of overruns since last reset. */
} ec_coe_emerg_ring_t;
/*****************************************************************************/

View File

@ -636,6 +636,8 @@ void ec_datagram_output_stats(
/*****************************************************************************/
/** Returns a string describing the datagram type.
*
* \return Pointer on a static memory containing the requested string.
*/
const char *ec_datagram_type_string(
const ec_datagram_t *datagram /**< EtherCAT datagram. */

View File

@ -42,12 +42,14 @@
/*****************************************************************************/
/** Datagram pair constructor.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_datagram_pair_init(
ec_datagram_pair_t *pair, /**< Datagram pair. */
ec_domain_t *domain, /**< Parent domain. */
uint32_t logical_offset,
uint8_t *data,
uint32_t logical_offset, /**< Logical offset. */
uint8_t *data, /**< Data pointer. */
size_t data_size, /**< Data size. */
const unsigned int used[] /**< input/output use count. */
)
@ -168,6 +170,8 @@ void ec_datagram_pair_clear(
/*****************************************************************************/
/** Process received data.
*
* \return Working counter sum over all devices.
*/
uint16_t ec_datagram_pair_process(
ec_datagram_pair_t *pair, /**< Datagram pair. */

View File

@ -48,7 +48,7 @@
*/
typedef struct {
struct list_head list; /**< List header. */
ec_domain_t *domain;
ec_domain_t *domain; /**< Parent domain. */
ec_datagram_t datagrams[EC_MAX_NUM_DEVICES]; /**< Datagrams. */
#if EC_MAX_NUM_DEVICES > 1
uint8_t *send_buffer;

View File

@ -200,6 +200,8 @@ void ec_debug_send(
*****************************************************************************/
/** Opens the virtual network device.
*
* \return Always zero (success).
*/
int ec_dbgdev_open(
struct net_device *dev /**< debug net_device */
@ -215,6 +217,8 @@ int ec_dbgdev_open(
/*****************************************************************************/
/** Stops the virtual network device.
*
* \return Always zero (success).
*/
int ec_dbgdev_stop(
struct net_device *dev /**< debug net_device */
@ -230,6 +234,8 @@ int ec_dbgdev_stop(
/*****************************************************************************/
/** Transmits data via the virtual network device.
*
* \return Always zero (success).
*/
int ec_dbgdev_tx(
struct sk_buff *skb, /**< transmit socket buffer */
@ -246,6 +252,8 @@ int ec_dbgdev_tx(
/*****************************************************************************/
/** Gets statistics about the virtual network device.
*
* \return Statistics.
*/
struct net_device_stats *ec_dbgdev_stats(
struct net_device *dev /**< debug net_device */

View File

@ -698,6 +698,8 @@ void ecdev_set_link(
/** Reads the link state.
*
* \ingroup DeviceInterface
*
* \return Link state.
*/
uint8_t ecdev_get_link(
const ec_device_t *device /**< EtherCAT device */

View File

@ -43,6 +43,8 @@
#include "domain.h"
#include "datagram_pair.h"
/** Extra debug output for redundancy functions.
*/
#define DEBUG_REDUNDANCY 0
/*****************************************************************************/
@ -187,6 +189,8 @@ int ec_domain_add_datagram_pair(
*
* Walks through the list of all FMMU configurations for the current datagram
* and ends before the current datagram.
*
* \return Non-zero if slave connfig was already counted.
*/
int shall_count(
const ec_fmmu_config_t *cur_fmmu, /**< Current FMMU with direction to
@ -340,6 +344,8 @@ unsigned int ec_domain_fmmu_count(const ec_domain_t *domain)
/*****************************************************************************/
/** Get a certain FMMU configuration via its position in the list.
*
* \return FMMU at position \a pos, or NULL.
*/
const ec_fmmu_config_t *ec_domain_find_fmmu(
const ec_domain_t *domain, /**< EtherCAT domain. */

View File

@ -98,6 +98,8 @@ static const struct net_device_ops ec_eoedev_ops = {
/** EoE constructor.
*
* Initializes the EoE handler, creates a net_device and registers it.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_eoe_init(
ec_eoe_t *eoe, /**< EoE handler */
@ -246,6 +248,8 @@ void ec_eoe_flush(ec_eoe_t *eoe /**< EoE handler */)
/*****************************************************************************/
/** Sends a frame or the next fragment.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_eoe_send(ec_eoe_t *eoe /**< EoE handler */)
{
@ -385,7 +389,7 @@ int ec_eoe_is_idle(const ec_eoe_t *eoe /**< EoE handler */)
* Starts a new receiving sequence by queueing a datagram that checks the
* slave's mailbox for a new EoE datagram.
*
* \fixme Use both devices.
* \todo Use both devices.
*/
void ec_eoe_state_rx_start(ec_eoe_t *eoe /**< EoE handler */)
{
@ -614,7 +618,7 @@ void ec_eoe_state_rx_fetch(ec_eoe_t *eoe /**< EoE handler */)
* Starts a new transmit sequence. If no data is available, a new receive
* sequence is started instead.
*
* \fixme Use both devices.
* \todo Use both devices.
*/
void ec_eoe_state_tx_start(ec_eoe_t *eoe /**< EoE handler */)
{
@ -754,6 +758,8 @@ void ec_eoe_state_tx_sent(ec_eoe_t *eoe /**< EoE handler */)
*****************************************************************************/
/** Opens the virtual network device.
*
* \return Always zero (success).
*/
int ec_eoedev_open(struct net_device *dev /**< EoE net_device */)
{
@ -774,6 +780,8 @@ int ec_eoedev_open(struct net_device *dev /**< EoE net_device */)
/*****************************************************************************/
/** Stops the virtual network device.
*
* \return Always zero (success).
*/
int ec_eoedev_stop(struct net_device *dev /**< EoE net_device */)
{
@ -794,6 +802,8 @@ int ec_eoedev_stop(struct net_device *dev /**< EoE net_device */)
/*****************************************************************************/
/** Transmits data via the virtual network device.
*
* \return Zero on success, non-zero on failure.
*/
int ec_eoedev_tx(struct sk_buff *skb, /**< transmit socket buffer */
struct net_device *dev /**< EoE net_device */
@ -844,6 +854,8 @@ int ec_eoedev_tx(struct sk_buff *skb, /**< transmit socket buffer */
/*****************************************************************************/
/** Gets statistics about the virtual network device.
*
* \return Statistics.
*/
struct net_device_stats *ec_eoedev_stats(
struct net_device *dev /**< EoE net_device */

View File

@ -103,7 +103,10 @@ void ec_foe_request_clear_data(
/** Pre-allocates the data memory.
*
* If the \a buffer_size is already bigger than \a size, nothing is done.
* If the internal \a buffer_size is already bigger than \a size, nothing is
* done.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_foe_request_alloc(
ec_foe_request_t *req, /**< FoE request. */
@ -131,6 +134,8 @@ int ec_foe_request_alloc(
/** Copies FoE data from an external source.
*
* If the \a buffer_size is to small, new memory is allocated.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_foe_request_copy_data(
ec_foe_request_t *req, /**< FoE request. */

View File

@ -27,7 +27,8 @@
*
*****************************************************************************/
/** \file EtherCAT CoE state machines.
/** \file
* EtherCAT CoE state machines.
*/
/*****************************************************************************/
@ -307,6 +308,10 @@ int ec_fsm_coe_check_emergency(
* CoE dictionary state machine
*****************************************************************************/
/** Prepare a dictionary request.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_fsm_coe_prepare_dict(
ec_fsm_coe_t *fsm, /**< Finite state machine. */
ec_datagram_t *datagram /**< Datagram to use. */
@ -455,6 +460,10 @@ void ec_fsm_coe_dict_check(
/*****************************************************************************/
/** Prepare an object description request.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_fsm_coe_dict_prepare_desc(
ec_fsm_coe_t *fsm, /**< Finite state machine. */
ec_datagram_t *datagram /**< Datagram to use. */
@ -733,6 +742,10 @@ void ec_fsm_coe_dict_desc_check(
/*****************************************************************************/
/** Prepare an entry description request.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_fsm_coe_dict_prepare_entry(
ec_fsm_coe_t *fsm, /**< Finite state machine */
ec_datagram_t *datagram /**< Datagram to use. */
@ -1172,6 +1185,10 @@ void ec_fsm_coe_dict_entry_response(
* CoE state machine
*****************************************************************************/
/** Prepare a donwnload request.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_fsm_coe_prepare_down_start(
ec_fsm_coe_t *fsm, /**< Finite state machine. */
ec_datagram_t *datagram /**< Datagram to use. */
@ -1814,6 +1831,10 @@ void ec_fsm_coe_down_seg_response(
/*****************************************************************************/
/** Prepare an upload request.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_fsm_coe_prepare_up(
ec_fsm_coe_t *fsm, /**< Finite state machine. */
ec_datagram_t *datagram /**< Datagram to use. */

View File

@ -230,9 +230,11 @@ void ec_fsm_foe_end(
/*****************************************************************************/
/** Sends a file or the next fragment.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_foe_prepare_data_send(
ec_fsm_foe_t *fsm,
ec_fsm_foe_t *fsm, /**< Finite state machine. */
ec_datagram_t *datagram /**< Datagram to use. */
)
{
@ -270,6 +272,8 @@ int ec_foe_prepare_data_send(
/*****************************************************************************/
/** Prepare a write request (WRQ) with filename
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_foe_prepare_wrq_send(
ec_fsm_foe_t *fsm, /**< Finite state machine. */
@ -545,6 +549,8 @@ void ec_fsm_foe_state_data_sent(
/*****************************************************************************/
/** Prepare a read request (RRQ) with filename
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_foe_prepare_rrq_send(
ec_fsm_foe_t *fsm, /**< Finite state machine. */
@ -577,6 +583,8 @@ int ec_foe_prepare_rrq_send(
/*****************************************************************************/
/** Prepare to send an acknowledge.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_foe_prepare_send_ack(
ec_fsm_foe_t *fsm, /**< FoE statemachine. */

View File

@ -959,6 +959,8 @@ void ec_fsm_master_enter_write_system_times(
/*****************************************************************************/
/** Configure 32 bit time offset.
*
* \return New offset.
*/
u64 ec_fsm_master_dc_offset32(
ec_fsm_master_t *fsm, /**< Master state machine. */
@ -999,6 +1001,8 @@ u64 ec_fsm_master_dc_offset32(
/*****************************************************************************/
/** Configure 64 bit time offset.
*
* \return New offset.
*/
u64 ec_fsm_master_dc_offset64(
ec_fsm_master_t *fsm, /**< Master state machine. */

View File

@ -27,7 +27,8 @@
*
*****************************************************************************/
/** \file EtherCAT PDO configuration state machine.
/** \file
* EtherCAT PDO configuration state machine.
*/
/*****************************************************************************/
@ -396,6 +397,8 @@ void ec_fsm_pdo_conf_state_start(
/*****************************************************************************/
/** Assign next PDO.
*
* \return Next PDO, or NULL.
*/
ec_pdo_t *ec_fsm_pdo_conf_action_next_pdo(
const ec_fsm_pdo_t *fsm, /**< PDO configuration state machine. */

View File

@ -363,6 +363,8 @@ void ec_fsm_pdo_entry_conf_state_start(
/*****************************************************************************/
/** Process next PDO entry.
*
* \return Next PDO entry, or NULL.
*/
ec_pdo_entry_t *ec_fsm_pdo_entry_conf_next_entry(
const ec_fsm_pdo_entry_t *fsm, /**< PDO mapping state machine. */

View File

@ -158,6 +158,8 @@ void ec_fsm_slave_set_ready(
/*****************************************************************************/
/** Returns, if the FSM is currently not busy and ready to execute.
*
* \return Non-zero if ready.
*/
int ec_fsm_slave_is_ready(
const ec_fsm_slave_t *fsm /**< Slave state machine. */

View File

@ -49,6 +49,8 @@
*/
#define DEBUG_LATENCY 0
/** Optional compiler attributes fo ioctl() functions.
*/
#if 0
#define ATTRIBUTES __attribute__ ((__noinline__))
#else
@ -75,6 +77,8 @@ static void ec_ioctl_strcpy(
/*****************************************************************************/
/** Get module information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_module(
void *arg /**< Userspace address to store the results. */
@ -94,6 +98,8 @@ static ATTRIBUTES int ec_ioctl_module(
/*****************************************************************************/
/** Get master information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_master(
ec_master_t *master, /**< EtherCAT master. */
@ -187,6 +193,8 @@ static ATTRIBUTES int ec_ioctl_master(
/*****************************************************************************/
/** Get slave information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave(
ec_master_t *master, /**< EtherCAT master. */
@ -272,6 +280,8 @@ static ATTRIBUTES int ec_ioctl_slave(
/*****************************************************************************/
/** Get slave sync manager information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_sync(
ec_master_t *master, /**< EtherCAT master. */
@ -323,6 +333,8 @@ static ATTRIBUTES int ec_ioctl_slave_sync(
/*****************************************************************************/
/** Get slave sync manager PDO information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_sync_pdo(
ec_master_t *master, /**< EtherCAT master. */
@ -380,6 +392,8 @@ static ATTRIBUTES int ec_ioctl_slave_sync_pdo(
/*****************************************************************************/
/** Get slave sync manager PDO entry information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_sync_pdo_entry(
ec_master_t *master, /**< EtherCAT master. */
@ -447,6 +461,8 @@ static ATTRIBUTES int ec_ioctl_slave_sync_pdo_entry(
/*****************************************************************************/
/** Get domain information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_domain(
ec_master_t *master, /**< EtherCAT master. */
@ -490,6 +506,8 @@ static ATTRIBUTES int ec_ioctl_domain(
/*****************************************************************************/
/** Get domain FMMU information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_domain_fmmu(
ec_master_t *master, /**< EtherCAT master. */
@ -540,6 +558,8 @@ static ATTRIBUTES int ec_ioctl_domain_fmmu(
/*****************************************************************************/
/** Get domain data.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_domain_data(
ec_master_t *master, /**< EtherCAT master. */
@ -583,6 +603,8 @@ static ATTRIBUTES int ec_ioctl_domain_data(
/*****************************************************************************/
/** Set master debug level.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_master_debug(
ec_master_t *master, /**< EtherCAT master. */
@ -595,6 +617,8 @@ static ATTRIBUTES int ec_ioctl_master_debug(
/*****************************************************************************/
/** Issue a bus scan.
*
* \return Always zero (success).
*/
static ATTRIBUTES int ec_ioctl_master_rescan(
ec_master_t *master, /**< EtherCAT master. */
@ -608,6 +632,8 @@ static ATTRIBUTES int ec_ioctl_master_rescan(
/*****************************************************************************/
/** Set slave state.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_state(
ec_master_t *master, /**< EtherCAT master. */
@ -641,6 +667,8 @@ static ATTRIBUTES int ec_ioctl_slave_state(
/*****************************************************************************/
/** Get slave SDO information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_sdo(
ec_master_t *master, /**< EtherCAT master. */
@ -688,6 +716,8 @@ static ATTRIBUTES int ec_ioctl_slave_sdo(
/*****************************************************************************/
/** Get slave SDO entry information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_sdo_entry(
ec_master_t *master, /**< EtherCAT master. */
@ -766,6 +796,8 @@ static ATTRIBUTES int ec_ioctl_slave_sdo_entry(
/*****************************************************************************/
/** Upload SDO.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_sdo_upload(
ec_master_t *master, /**< EtherCAT master. */
@ -810,6 +842,8 @@ static ATTRIBUTES int ec_ioctl_slave_sdo_upload(
/*****************************************************************************/
/** Download SDO.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_sdo_download(
ec_master_t *master, /**< EtherCAT master. */
@ -856,6 +890,8 @@ static ATTRIBUTES int ec_ioctl_slave_sdo_download(
/*****************************************************************************/
/** Read a slave's SII.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_sii_read(
ec_master_t *master, /**< EtherCAT master. */
@ -902,6 +938,8 @@ static ATTRIBUTES int ec_ioctl_slave_sii_read(
/*****************************************************************************/
/** Write a slave's SII.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_sii_write(
ec_master_t *master, /**< EtherCAT master. */
@ -988,6 +1026,8 @@ static ATTRIBUTES int ec_ioctl_slave_sii_write(
/*****************************************************************************/
/** Read a slave's registers.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_reg_read(
ec_master_t *master, /**< EtherCAT master. */
@ -1065,6 +1105,8 @@ static ATTRIBUTES int ec_ioctl_slave_reg_read(
/*****************************************************************************/
/** Write a slave's registers.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_reg_write(
ec_master_t *master, /**< EtherCAT master. */
@ -1141,6 +1183,8 @@ static ATTRIBUTES int ec_ioctl_slave_reg_write(
/*****************************************************************************/
/** Get slave configuration information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_config(
ec_master_t *master, /**< EtherCAT master. */
@ -1197,6 +1241,8 @@ static ATTRIBUTES int ec_ioctl_config(
/*****************************************************************************/
/** Get slave configuration PDO information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_config_pdo(
ec_master_t *master, /**< EtherCAT master. */
@ -1251,6 +1297,8 @@ static ATTRIBUTES int ec_ioctl_config_pdo(
/*****************************************************************************/
/** Get slave configuration PDO entry information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_config_pdo_entry(
ec_master_t *master, /**< EtherCAT master. */
@ -1314,6 +1362,8 @@ static ATTRIBUTES int ec_ioctl_config_pdo_entry(
/*****************************************************************************/
/** Get slave configuration SDO information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_config_sdo(
ec_master_t *master, /**< EtherCAT master. */
@ -1376,6 +1426,8 @@ static ATTRIBUTES int ec_ioctl_config_sdo(
/*****************************************************************************/
/** Get slave configuration IDN information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_config_idn(
ec_master_t *master, /**< EtherCAT master. */
@ -1440,6 +1492,8 @@ static ATTRIBUTES int ec_ioctl_config_idn(
#ifdef EC_EOE
/** Get EoE handler information.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_eoe_handler(
ec_master_t *master, /**< EtherCAT master. */
@ -1490,6 +1544,8 @@ static ATTRIBUTES int ec_ioctl_eoe_handler(
/*****************************************************************************/
/** Request the master from userspace.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_request(
ec_master_t *master, /**< EtherCAT master. */
@ -1513,6 +1569,8 @@ static ATTRIBUTES int ec_ioctl_request(
/*****************************************************************************/
/** Create a domain.
*
* \return Domain index on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_create_domain(
ec_master_t *master, /**< EtherCAT master. */
@ -1535,6 +1593,8 @@ static ATTRIBUTES int ec_ioctl_create_domain(
/*****************************************************************************/
/** Create a slave configuration.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_create_slave_config(
ec_master_t *master, /**< EtherCAT master. */
@ -1579,6 +1639,8 @@ static ATTRIBUTES int ec_ioctl_create_slave_config(
/*****************************************************************************/
/** Select the DC reference clock.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_select_ref_clock(
ec_master_t *master, /**< EtherCAT master. */
@ -1618,6 +1680,8 @@ out_return:
/*****************************************************************************/
/** Activates the master.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_activate(
ec_master_t *master, /**< EtherCAT master. */
@ -1699,6 +1763,8 @@ static ATTRIBUTES int ec_ioctl_activate(
/*****************************************************************************/
/** Deactivates the master.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_deactivate(
ec_master_t *master, /**< EtherCAT master. */
@ -1716,6 +1782,8 @@ static ATTRIBUTES int ec_ioctl_deactivate(
/*****************************************************************************/
/** Set max. number of databytes in a cycle
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_set_send_interval(
ec_master_t *master, /**< EtherCAT master. */
@ -1746,6 +1814,8 @@ static ATTRIBUTES int ec_ioctl_set_send_interval(
/*****************************************************************************/
/** Send frames.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_send(
ec_master_t *master, /**< EtherCAT master. */
@ -1764,6 +1834,8 @@ static ATTRIBUTES int ec_ioctl_send(
/*****************************************************************************/
/** Receive frames.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_receive(
ec_master_t *master, /**< EtherCAT master. */
@ -1782,6 +1854,8 @@ static ATTRIBUTES int ec_ioctl_receive(
/*****************************************************************************/
/** Get the master state.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_master_state(
ec_master_t *master, /**< EtherCAT master. */
@ -1801,7 +1875,9 @@ static ATTRIBUTES int ec_ioctl_master_state(
/*****************************************************************************/
/** Get the master state.
/** Get the link state.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_master_link_state(
ec_master_t *master, /**< EtherCAT master. */
@ -1831,7 +1907,9 @@ static ATTRIBUTES int ec_ioctl_master_link_state(
/*****************************************************************************/
/** Set the master dc app time.
/** Set the master DC application time.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_app_time(
ec_master_t *master, /**< EtherCAT master. */
@ -1855,6 +1933,8 @@ static ATTRIBUTES int ec_ioctl_app_time(
/*****************************************************************************/
/** Sync the reference clock.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sync_ref(
ec_master_t *master, /**< EtherCAT master. */
@ -1873,6 +1953,8 @@ static ATTRIBUTES int ec_ioctl_sync_ref(
/*****************************************************************************/
/** Sync the slave clocks.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sync_slaves(
ec_master_t *master, /**< EtherCAT master. */
@ -1891,6 +1973,8 @@ static ATTRIBUTES int ec_ioctl_sync_slaves(
/*****************************************************************************/
/** Get the system time of the reference clock.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_ref_clock_time(
ec_master_t *master, /**< EtherCAT master. */
@ -1920,6 +2004,8 @@ static ATTRIBUTES int ec_ioctl_ref_clock_time(
/*****************************************************************************/
/** Queue the sync monitoring datagram.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sync_mon_queue(
ec_master_t *master, /**< EtherCAT master. */
@ -1938,6 +2024,8 @@ static ATTRIBUTES int ec_ioctl_sync_mon_queue(
/*****************************************************************************/
/** Processes the sync monitoring datagram.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sync_mon_process(
ec_master_t *master, /**< EtherCAT master. */
@ -1961,6 +2049,8 @@ static ATTRIBUTES int ec_ioctl_sync_mon_process(
/*****************************************************************************/
/** Reset configuration.
*
* \return Always zero (success).
*/
static ATTRIBUTES int ec_ioctl_reset(
ec_master_t *master, /**< EtherCAT master. */
@ -1977,6 +2067,8 @@ static ATTRIBUTES int ec_ioctl_reset(
/*****************************************************************************/
/** Configure a sync manager.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_sync(
ec_master_t *master, /**< EtherCAT master. */
@ -2028,6 +2120,8 @@ out_return:
/*****************************************************************************/
/** Configure a slave's watchdogs.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_watchdog(
ec_master_t *master, /**< EtherCAT master. */
@ -2071,6 +2165,8 @@ out_return:
/*****************************************************************************/
/** Add a PDO to the assignment.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_add_pdo(
ec_master_t *master, /**< EtherCAT master. */
@ -2095,7 +2191,7 @@ static ATTRIBUTES int ec_ioctl_sc_add_pdo(
return -ENOENT;
}
up(&master->master_sem); /** \fixme sc could be invalidated */
up(&master->master_sem); /** \todo sc could be invalidated */
return ecrt_slave_config_pdo_assign_add(sc, data.sync_index, data.index);
}
@ -2103,6 +2199,8 @@ static ATTRIBUTES int ec_ioctl_sc_add_pdo(
/*****************************************************************************/
/** Clears the PDO assignment.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_clear_pdos(
ec_master_t *master, /**< EtherCAT master. */
@ -2127,7 +2225,7 @@ static ATTRIBUTES int ec_ioctl_sc_clear_pdos(
return -ENOENT;
}
up(&master->master_sem); /** \fixme sc could be invalidated */
up(&master->master_sem); /** \todo sc could be invalidated */
ecrt_slave_config_pdo_assign_clear(sc, data.sync_index);
return 0;
@ -2136,6 +2234,8 @@ static ATTRIBUTES int ec_ioctl_sc_clear_pdos(
/*****************************************************************************/
/** Add an entry to a PDO's mapping.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_add_entry(
ec_master_t *master, /**< EtherCAT master. */
@ -2160,7 +2260,7 @@ static ATTRIBUTES int ec_ioctl_sc_add_entry(
return -ENOENT;
}
up(&master->master_sem); /** \fixme sc could be invalidated */
up(&master->master_sem); /** \todo sc could be invalidated */
return ecrt_slave_config_pdo_mapping_add(sc, data.pdo_index,
data.entry_index, data.entry_subindex, data.entry_bit_length);
@ -2169,6 +2269,8 @@ static ATTRIBUTES int ec_ioctl_sc_add_entry(
/*****************************************************************************/
/** Clears the mapping of a PDO.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_clear_entries(
ec_master_t *master, /**< EtherCAT master. */
@ -2193,7 +2295,7 @@ static ATTRIBUTES int ec_ioctl_sc_clear_entries(
return -ENOENT;
}
up(&master->master_sem); /** \fixme sc could be invalidated */
up(&master->master_sem); /** \todo sc could be invalidated */
ecrt_slave_config_pdo_mapping_clear(sc, data.index);
return 0;
@ -2202,6 +2304,8 @@ static ATTRIBUTES int ec_ioctl_sc_clear_entries(
/*****************************************************************************/
/** Registers a PDO entry.
*
* \return Process data offset on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_reg_pdo_entry(
ec_master_t *master, /**< EtherCAT master. */
@ -2233,7 +2337,7 @@ static ATTRIBUTES int ec_ioctl_sc_reg_pdo_entry(
return -ENOENT;
}
up(&master->master_sem); /** \fixme sc or domain could be invalidated */
up(&master->master_sem); /** \todo sc or domain could be invalidated */
ret = ecrt_slave_config_reg_pdo_entry(sc, data.entry_index,
data.entry_subindex, domain, &data.bit_position);
@ -2247,6 +2351,8 @@ static ATTRIBUTES int ec_ioctl_sc_reg_pdo_entry(
/*****************************************************************************/
/** Registers a PDO entry by its position.
*
* \return Process data offset on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_reg_pdo_pos(
ec_master_t *master, /**< EtherCAT master. */
@ -2281,7 +2387,7 @@ static ATTRIBUTES int ec_ioctl_sc_reg_pdo_pos(
return -ENOENT;
}
up(&master->master_sem); /** \fixme sc or domain could be invalidated */
up(&master->master_sem); /** \todo sc or domain could be invalidated */
ret = ecrt_slave_config_reg_pdo_entry_pos(sc, io.sync_index,
io.pdo_pos, io.entry_pos, domain, &io.bit_position);
@ -2295,6 +2401,8 @@ static ATTRIBUTES int ec_ioctl_sc_reg_pdo_pos(
/*****************************************************************************/
/** Sets the DC AssignActivate word and the sync signal times.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_dc(
ec_master_t *master, /**< EtherCAT master. */
@ -2333,6 +2441,8 @@ static ATTRIBUTES int ec_ioctl_sc_dc(
/*****************************************************************************/
/** Configures an SDO.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_sdo(
ec_master_t *master, /**< EtherCAT master. */
@ -2374,7 +2484,7 @@ static ATTRIBUTES int ec_ioctl_sc_sdo(
return -ENOENT;
}
up(&master->master_sem); /** \fixme sc could be invalidated */
up(&master->master_sem); /** \todo sc could be invalidated */
if (data.complete_access) {
ret = ecrt_slave_config_complete_sdo(sc,
@ -2390,6 +2500,8 @@ static ATTRIBUTES int ec_ioctl_sc_sdo(
/*****************************************************************************/
/** Set the emergency ring buffer size.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_emerg_size(
ec_master_t *master, /**< EtherCAT master. */
@ -2426,6 +2538,8 @@ static ATTRIBUTES int ec_ioctl_sc_emerg_size(
/*****************************************************************************/
/** Get an emergency message from the ring.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_emerg_pop(
ec_master_t *master, /**< EtherCAT master. */
@ -2468,6 +2582,8 @@ static ATTRIBUTES int ec_ioctl_sc_emerg_pop(
/*****************************************************************************/
/** Clear the emergency ring.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_emerg_clear(
ec_master_t *master, /**< EtherCAT master. */
@ -2499,6 +2615,8 @@ static ATTRIBUTES int ec_ioctl_sc_emerg_clear(
/*****************************************************************************/
/** Get the number of emergency overruns.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_emerg_overruns(
ec_master_t *master, /**< EtherCAT master. */
@ -2542,6 +2660,8 @@ static ATTRIBUTES int ec_ioctl_sc_emerg_overruns(
/*****************************************************************************/
/** Create an SDO request.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_create_sdo_request(
ec_master_t *master, /**< EtherCAT master. */
@ -2575,7 +2695,7 @@ static ATTRIBUTES int ec_ioctl_sc_create_sdo_request(
data.request_index++;
}
up(&master->master_sem); /** \fixme sc could be invalidated */
up(&master->master_sem); /** \todo sc could be invalidated */
req = ecrt_slave_config_create_sdo_request_err(sc, data.sdo_index,
data.sdo_subindex, data.size);
@ -2591,6 +2711,8 @@ static ATTRIBUTES int ec_ioctl_sc_create_sdo_request(
/*****************************************************************************/
/** Create a register request.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_create_reg_request(
ec_master_t *master, /**< EtherCAT master. */
@ -2626,7 +2748,7 @@ static ATTRIBUTES int ec_ioctl_sc_create_reg_request(
io.request_index++;
}
up(&master->master_sem); /** \fixme sc could be invalidated */
up(&master->master_sem); /** \todo sc could be invalidated */
reg = ecrt_slave_config_create_reg_request_err(sc, io.mem_size);
if (IS_ERR(reg)) {
@ -2643,6 +2765,8 @@ static ATTRIBUTES int ec_ioctl_sc_create_reg_request(
/*****************************************************************************/
/** Create a VoE handler.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_create_voe_handler(
ec_master_t *master, /**< EtherCAT master. */
@ -2676,7 +2800,7 @@ static ATTRIBUTES int ec_ioctl_sc_create_voe_handler(
data.voe_index++;
}
up(&master->master_sem); /** \fixme sc could be invalidated */
up(&master->master_sem); /** \todo sc could be invalidated */
voe = ecrt_slave_config_create_voe_handler_err(sc, data.size);
if (IS_ERR(voe))
@ -2691,6 +2815,8 @@ static ATTRIBUTES int ec_ioctl_sc_create_voe_handler(
/*****************************************************************************/
/** Get the slave configuration's state.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_state(
ec_master_t *master, /**< EtherCAT master. */
@ -2727,6 +2853,8 @@ static ATTRIBUTES int ec_ioctl_sc_state(
/*****************************************************************************/
/** Configures an IDN.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sc_idn(
ec_master_t *master, /**< EtherCAT master. */
@ -2768,7 +2896,7 @@ static ATTRIBUTES int ec_ioctl_sc_idn(
return -ENOENT;
}
up(&master->master_sem); /** \fixme sc could be invalidated */
up(&master->master_sem); /** \todo sc could be invalidated */
ret = ecrt_slave_config_idn(
sc, ioctl.drive_no, ioctl.idn, ioctl.al_state, data, ioctl.size);
@ -2779,6 +2907,8 @@ static ATTRIBUTES int ec_ioctl_sc_idn(
/*****************************************************************************/
/** Gets the domain's data size.
*
* \return Domain size, or a negative error code.
*/
static ATTRIBUTES int ec_ioctl_domain_size(
ec_master_t *master, /**< EtherCAT master. */
@ -2811,6 +2941,8 @@ static ATTRIBUTES int ec_ioctl_domain_size(
/*****************************************************************************/
/** Gets the domain's offset in the total process data.
*
* \return Domain offset, or a negative error code.
*/
static ATTRIBUTES int ec_ioctl_domain_offset(
ec_master_t *master, /**< EtherCAT master. */
@ -2843,6 +2975,8 @@ static ATTRIBUTES int ec_ioctl_domain_offset(
/*****************************************************************************/
/** Process the domain.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_domain_process(
ec_master_t *master, /**< EtherCAT master. */
@ -2869,6 +3003,8 @@ static ATTRIBUTES int ec_ioctl_domain_process(
/*****************************************************************************/
/** Queue the domain.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_domain_queue(
ec_master_t *master, /**< EtherCAT master. */
@ -2895,6 +3031,8 @@ static ATTRIBUTES int ec_ioctl_domain_queue(
/*****************************************************************************/
/** Get the domain state.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_domain_state(
ec_master_t *master, /**< EtherCAT master. */
@ -2931,6 +3069,8 @@ static ATTRIBUTES int ec_ioctl_domain_state(
/*****************************************************************************/
/** Sets an SDO request's SDO index and subindex.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sdo_request_index(
ec_master_t *master, /**< EtherCAT master. */
@ -2966,6 +3106,8 @@ static ATTRIBUTES int ec_ioctl_sdo_request_index(
/*****************************************************************************/
/** Sets an SDO request's timeout.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sdo_request_timeout(
ec_master_t *master, /**< EtherCAT master. */
@ -3001,6 +3143,8 @@ static ATTRIBUTES int ec_ioctl_sdo_request_timeout(
/*****************************************************************************/
/** Gets an SDO request's state.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sdo_request_state(
ec_master_t *master, /**< EtherCAT master. */
@ -3044,6 +3188,8 @@ static ATTRIBUTES int ec_ioctl_sdo_request_state(
/*****************************************************************************/
/** Starts an SDO read operation.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sdo_request_read(
ec_master_t *master, /**< EtherCAT master. */
@ -3079,6 +3225,8 @@ static ATTRIBUTES int ec_ioctl_sdo_request_read(
/*****************************************************************************/
/** Starts an SDO write operation.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sdo_request_write(
ec_master_t *master, /**< EtherCAT master. */
@ -3128,6 +3276,8 @@ static ATTRIBUTES int ec_ioctl_sdo_request_write(
/*****************************************************************************/
/** Read SDO data.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_sdo_request_data(
ec_master_t *master, /**< EtherCAT master. */
@ -3166,6 +3316,8 @@ static ATTRIBUTES int ec_ioctl_sdo_request_data(
/*****************************************************************************/
/** Read register data.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_reg_request_data(
ec_master_t *master, /**< EtherCAT master. */
@ -3211,6 +3363,8 @@ static ATTRIBUTES int ec_ioctl_reg_request_data(
/*****************************************************************************/
/** Gets an register request's state.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_reg_request_state(
ec_master_t *master, /**< EtherCAT master. */
@ -3254,6 +3408,8 @@ static ATTRIBUTES int ec_ioctl_reg_request_state(
/*****************************************************************************/
/** Starts an register write operation.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_reg_request_write(
ec_master_t *master, /**< EtherCAT master. */
@ -3300,6 +3456,8 @@ static ATTRIBUTES int ec_ioctl_reg_request_write(
/*****************************************************************************/
/** Starts an register read operation.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_reg_request_read(
ec_master_t *master, /**< EtherCAT master. */
@ -3341,6 +3499,8 @@ static ATTRIBUTES int ec_ioctl_reg_request_read(
/*****************************************************************************/
/** Sets the VoE send header.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_voe_send_header(
ec_master_t *master, /**< EtherCAT master. */
@ -3384,6 +3544,8 @@ static ATTRIBUTES int ec_ioctl_voe_send_header(
/*****************************************************************************/
/** Gets the received VoE header.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_voe_rec_header(
ec_master_t *master, /**< EtherCAT master. */
@ -3430,6 +3592,8 @@ static ATTRIBUTES int ec_ioctl_voe_rec_header(
/*****************************************************************************/
/** Starts a VoE read operation.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_voe_read(
ec_master_t *master, /**< EtherCAT master. */
@ -3465,6 +3629,8 @@ static ATTRIBUTES int ec_ioctl_voe_read(
/*****************************************************************************/
/** Starts a VoE read operation without sending a sync message first.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_voe_read_nosync(
ec_master_t *master, /**< EtherCAT master. */
@ -3500,6 +3666,8 @@ static ATTRIBUTES int ec_ioctl_voe_read_nosync(
/*****************************************************************************/
/** Starts a VoE write operation.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_voe_write(
ec_master_t *master, /**< EtherCAT master. */
@ -3544,6 +3712,8 @@ static ATTRIBUTES int ec_ioctl_voe_write(
/*****************************************************************************/
/** Executes the VoE state machine.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_voe_exec(
ec_master_t *master, /**< EtherCAT master. */
@ -3587,6 +3757,8 @@ static ATTRIBUTES int ec_ioctl_voe_exec(
/*****************************************************************************/
/** Reads the received VoE data.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_voe_data(
ec_master_t *master, /**< EtherCAT master. */
@ -3625,6 +3797,8 @@ static ATTRIBUTES int ec_ioctl_voe_data(
/*****************************************************************************/
/** Read a file from a slave via FoE.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_foe_read(
ec_master_t *master, /**< EtherCAT master. */
@ -3719,6 +3893,8 @@ static ATTRIBUTES int ec_ioctl_slave_foe_read(
/*****************************************************************************/
/** Write a file to a slave via FoE
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_foe_write(
ec_master_t *master, /**< EtherCAT master. */
@ -3805,6 +3981,8 @@ static ATTRIBUTES int ec_ioctl_slave_foe_write(
/*****************************************************************************/
/** Read an SoE IDN.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_soe_read(
ec_master_t *master, /**< EtherCAT master. */
@ -3852,6 +4030,8 @@ static ATTRIBUTES int ec_ioctl_slave_soe_read(
/*****************************************************************************/
/** Write an IDN to a slave via SoE.
*
* \return Zero on success, otherwise a negative error code.
*/
static ATTRIBUTES int ec_ioctl_slave_soe_write(
ec_master_t *master, /**< EtherCAT master. */
@ -3895,6 +4075,8 @@ static ATTRIBUTES int ec_ioctl_slave_soe_write(
/*****************************************************************************/
/** ioctl() function to use.
*/
#ifdef EC_IOCTL_RTDM
#define EC_IOCTL ec_ioctl_rtdm
#else
@ -3902,9 +4084,15 @@ static ATTRIBUTES int ec_ioctl_slave_soe_write(
#endif
/** Called when an ioctl() command is issued.
*
* \return ioctl() return code.
*/
long EC_IOCTL(ec_master_t *master, ec_ioctl_context_t *ctx,
unsigned int cmd, void *arg)
long EC_IOCTL(
ec_master_t *master, /**< EtherCAT master. */
ec_ioctl_context_t *ctx, /**< Device context. */
unsigned int cmd, /**< ioctl() command identifier. */
void *arg /**< ioctl() argument. */
)
{
#if DEBUG_LATENCY
cycles_t a = get_cycles(), b;

View File

@ -614,6 +614,8 @@ void ec_master_thread_stop(
/*****************************************************************************/
/** Transition function from ORPHANED to IDLE phase.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_master_enter_idle_phase(
ec_master_t *master /**< EtherCAT master */
@ -669,6 +671,8 @@ void ec_master_leave_idle_phase(ec_master_t *master /**< EtherCAT master */)
/*****************************************************************************/
/** Transition function from IDLE to OPERATION phase.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_master_enter_operation_phase(
ec_master_t *master /**< EtherCAT master */
@ -897,6 +901,8 @@ void ec_master_set_send_interval(
/*****************************************************************************/
/** Searches for a free datagram in the external datagram ring.
*
* \return Next free datagram, or NULL.
*/
ec_datagram_t *ec_master_get_external_datagram(
ec_master_t *master /**< EtherCAT master */
@ -1779,6 +1785,8 @@ void ec_master_attach_slave_configs(
} while (0)
/** Finds a slave in the bus, given the alias and position.
*
* \return Search result, or NULL.
*/
ec_slave_t *ec_master_find_slave(
ec_master_t *master, /**< EtherCAT master. */
@ -1793,6 +1801,8 @@ ec_slave_t *ec_master_find_slave(
/** Finds a slave in the bus, given the alias and position.
*
* Const version.
*
* \return Search result, or NULL.
*/
const ec_slave_t *ec_master_find_slave_const(
const ec_master_t *master, /**< EtherCAT master. */
@ -2068,6 +2078,8 @@ void ec_master_find_dc_ref_clock(
/*****************************************************************************/
/** Calculates the bus topology; recursion function.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_master_calc_topology_rec(
ec_master_t *master, /**< EtherCAT master. */
@ -2199,6 +2211,8 @@ void ec_master_request_op(
*****************************************************************************/
/** Same as ecrt_master_create_domain(), but with ERR_PTR() return value.
*
* \return New domain, or ERR_PTR() return value.
*/
ec_domain_t *ecrt_master_create_domain_err(
ec_master_t *master /**< master */

View File

@ -103,6 +103,8 @@
* where INDEX is the master index.
*
* \param master EtherCAT master
* \param level Debug level. Master's debug level must be >= \a level for
* output.
* \param fmt format string (like in printf())
* \param args arguments (optional)
*/
@ -318,6 +320,8 @@ int ec_master_init(ec_master_t *, unsigned int, const uint8_t *,
const uint8_t *, dev_t, struct class *, unsigned int);
void ec_master_clear(ec_master_t *);
/** Number of Ethernet devices.
*/
#if EC_MAX_NUM_DEVICES > 1
#define ec_master_num_devices(MASTER) ((MASTER)->num_devices)
#else

View File

@ -388,6 +388,8 @@ void ec_print_data_diff(const uint8_t *d1, /**< first data */
/*****************************************************************************/
/** Prints slave states in clear text.
*
* \return Size of the created string.
*/
size_t ec_state_string(uint8_t states, /**< slave states */
char *buffer, /**< target buffer
@ -522,6 +524,8 @@ ec_device_t *ecdev_offer(
/** Request a master.
*
* Same as ecrt_request_master(), but with ERR_PTR() return value.
*
* \return Requested master.
*/
ec_master_t *ecrt_request_master_err(
unsigned int master_index /**< Master index. */

View File

@ -273,6 +273,8 @@ unsigned int ec_pdo_entry_count(
/** Finds a PDO entry via its position in the list.
*
* Const version.
*
* \return Search result, or NULL.
*/
const ec_pdo_entry_t *ec_pdo_find_entry_by_pos_const(
const ec_pdo_t *pdo, /**< PDO. */

View File

@ -237,6 +237,8 @@ int ec_pdo_list_equal(
/*****************************************************************************/
/** Finds a PDO with the given index.
*
* \return Search result, or NULL.
*/
ec_pdo_t *ec_pdo_list_find_pdo(
const ec_pdo_list_t *pl, /**< PDO list. */
@ -257,6 +259,8 @@ ec_pdo_t *ec_pdo_list_find_pdo(
/*****************************************************************************/
/** Finds a PDO with the given index and returns a const pointer.
*
* \return Search result, or NULL.
*/
const ec_pdo_t *ec_pdo_list_find_pdo_const(
const ec_pdo_list_t *pl, /**< PDO list. */
@ -279,6 +283,8 @@ const ec_pdo_t *ec_pdo_list_find_pdo_const(
/** Finds a PDO via its position in the list.
*
* Const version.
*
* \return Zero on success, otherwise a negative error code.
*/
const ec_pdo_t *ec_pdo_list_find_pdo_by_pos_const(
const ec_pdo_list_t *pl, /**< PDO list. */

View File

@ -42,6 +42,8 @@
/*****************************************************************************/
/** Register request constructor.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_reg_request_init(
ec_reg_request_t *reg, /**< Register request. */

View File

@ -52,7 +52,7 @@ struct ec_reg_request {
ec_direction_t dir; /**< Direction. EC_DIR_OUTPUT means writing to the
slave, EC_DIR_INPUT means reading from the slave. */
uint16_t address; /**< Register address. */
size_t transfer_size; /*< Size of the data to transfer. */
size_t transfer_size; /**< Size of the data to transfer. */
ec_internal_request_state_t state; /**< Request state. */
};

View File

@ -45,8 +45,8 @@
/** Context structure for an open RTDM file handle.
*/
typedef struct {
rtdm_user_info_t *user_info;
ec_ioctl_context_t ioctl_ctx;
rtdm_user_info_t *user_info; /**< RTDM user info. */
ec_ioctl_context_t ioctl_ctx; /**< Context structure. */
} ec_rtdm_context_t;
/****************************************************************************/

View File

@ -35,9 +35,11 @@ struct rtdm_device;
/*****************************************************************************/
/** EtherCAT RTDM device.
*/
typedef struct ec_rtdm_dev {
ec_master_t *master;
struct rtdm_device *dev;
ec_master_t *master; /**< Master pointer. */
struct rtdm_device *dev; /**< RTDM device. */
} ec_rtdm_dev_t;
/*****************************************************************************/

View File

@ -85,6 +85,8 @@ void ec_sdo_request_clear(
/** Copy another SDO request.
*
* \attention Only the index subindex and data are copied.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_sdo_request_copy(
ec_sdo_request_t *req, /**< SDO request. */

View File

@ -797,6 +797,8 @@ void ec_slave_attach_pdo_names(
/*****************************************************************************/
/** Returns the previous connected port of a given port.
*
* \return Port index.
*/
unsigned int ec_slave_get_previous_port(
ec_slave_t *slave, /**< EtherCAT slave. */
@ -825,6 +827,8 @@ unsigned int ec_slave_get_previous_port(
/*****************************************************************************/
/** Returns the next connected port of a given port.
*
* \return Port index.
*/
unsigned int ec_slave_get_next_port(
ec_slave_t *slave, /**< EtherCAT slave. */
@ -853,6 +857,8 @@ unsigned int ec_slave_get_next_port(
/*****************************************************************************/
/** Calculates the sum of round-trip-times of connected ports 1-3.
*
* \return Round-trip-time in ns.
*/
uint32_t ec_slave_calc_rtt_sum(
ec_slave_t *slave /**< EtherCAT slave. */
@ -877,6 +883,8 @@ uint32_t ec_slave_calc_rtt_sum(
/*****************************************************************************/
/** Finds the next slave supporting DC delay measurement.
*
* \return Next DC slave, or NULL.
*/
ec_slave_t *ec_slave_find_next_dc_slave(
ec_slave_t *slave /**< EtherCAT slave. */

View File

@ -98,6 +98,8 @@
* POSITION is the slave's ring position.
*
* \param slave EtherCAT slave
* \param level Debug level. Master's debug level must be >= \a level for
* output.
* \param fmt format string (like in printf())
* \param args arguments (optional)
*/

View File

@ -388,6 +388,8 @@ unsigned int ec_slave_config_sdo_count(
/** Finds an SDO configuration via its position in the list.
*
* Const version.
*
* \return Search result, or NULL.
*/
const ec_sdo_request_t *ec_slave_config_get_sdo_by_pos_const(
const ec_slave_config_t *sc, /**< Slave configuration. */
@ -430,6 +432,8 @@ unsigned int ec_slave_config_idn_count(
/** Finds an IDN configuration via its position in the list.
*
* Const version.
*
* \return Search result, or NULL.
*/
const ec_soe_request_t *ec_slave_config_get_idn_by_pos_const(
const ec_slave_config_t *sc, /**< Slave configuration. */
@ -450,6 +454,8 @@ const ec_soe_request_t *ec_slave_config_get_idn_by_pos_const(
/*****************************************************************************/
/** Finds a CoE handler via its position in the list.
*
* \return Search result, or NULL.
*/
ec_sdo_request_t *ec_slave_config_find_sdo_request(
ec_slave_config_t *sc, /**< Slave configuration. */
@ -470,6 +476,8 @@ ec_sdo_request_t *ec_slave_config_find_sdo_request(
/*****************************************************************************/
/** Finds a register handler via its position in the list.
*
* \return Search result, or NULL.
*/
ec_reg_request_t *ec_slave_config_find_reg_request(
ec_slave_config_t *sc, /**< Slave configuration. */
@ -490,6 +498,8 @@ ec_reg_request_t *ec_slave_config_find_reg_request(
/*****************************************************************************/
/** Finds a VoE handler via its position in the list.
*
* \return Search result, or NULL.
*/
ec_voe_handler_t *ec_slave_config_find_voe_handler(
ec_slave_config_t *sc, /**< Slave configuration. */

View File

@ -98,6 +98,8 @@
* and ALIAS and POSITION identify the configuration.
*
* \param sc EtherCAT slave configuration
* \param level Debug level. Master's debug level must be >= \a level for
* output.
* \param fmt format string (like in printf())
* \param args arguments (optional)
*/

View File

@ -84,6 +84,8 @@ void ec_soe_request_clear(
/*****************************************************************************/
/** Copy another SoE request.
*
* \return Zero on success, otherwise a negative error code.
*/
int ec_soe_request_copy(
ec_soe_request_t *req, /**< SoE request. */

View File

@ -161,6 +161,8 @@ int ec_sync_add_pdo(
/*****************************************************************************/
/** Determines the default direction from the control register.
*
* \return Direction.
*/
ec_direction_t ec_sync_default_direction(
const ec_sync_t *sync /**< EtherCAT sync manager. */

View File

@ -106,6 +106,8 @@ void ec_voe_handler_clear(
/*****************************************************************************/
/** Get usable memory size.
*
* \return Memory size.
*/
size_t ec_voe_handler_mem_size(
const ec_voe_handler_t *voe /**< VoE handler. */