Improved source code doc.
This commit is contained in:
parent
1d3fe7a613
commit
c0b7fca9b6
|
|
@ -297,10 +297,10 @@ typedef struct {
|
|||
uint8_t subindex; /**< Pdo entry subindex. */
|
||||
unsigned int *offset; /**< Pointer to a variable to store the Pdo entry's
|
||||
(byte-)offset in the process data. */
|
||||
unsigned int *bit_position; /** Pointer to a variable to store a bit
|
||||
position (0-7) within the \a offset. Can be
|
||||
NULL, in which case an error is raised if the
|
||||
Pdo entry does not byte-align. */
|
||||
unsigned int *bit_position; /**< Pointer to a variable to store a bit
|
||||
position (0-7) within the \a offset. Can be
|
||||
NULL, in which case an error is raised if the
|
||||
Pdo entry does not byte-align. */
|
||||
} ec_pdo_entry_reg_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -328,13 +328,24 @@ unsigned int ecrt_version_magic(void);
|
|||
|
||||
/** Requests an EtherCAT master for realtime operation.
|
||||
*
|
||||
* \return pointer to reserved master, or NULL on error
|
||||
* Before an application can access an EtherCAT master, it has to reserve one
|
||||
* for exclusive use.
|
||||
*
|
||||
* This function has to be the first function an application has to call to
|
||||
* use EtherCAT. The function takes the index of the master as its argument.
|
||||
* The first master has index 0, the n-th master has index n - 1. The number
|
||||
* of masters has to be specified when loading the master module.
|
||||
*
|
||||
* \return Pointer to reserved master, or \a NULL on error.
|
||||
*/
|
||||
ec_master_t *ecrt_request_master(
|
||||
unsigned int master_index /**< Index of the master to request. */
|
||||
);
|
||||
|
||||
/** Releases a requested EtherCAT master.
|
||||
*
|
||||
* After use, a master it has to be released to make it available for other
|
||||
* applications.
|
||||
*/
|
||||
void ecrt_release_master(
|
||||
ec_master_t *master /**< EtherCAT master */
|
||||
|
|
@ -345,10 +356,16 @@ void ecrt_release_master(
|
|||
*****************************************************************************/
|
||||
|
||||
/** Sets the locking callbacks.
|
||||
*
|
||||
* For concurrent master access, the application has to provide a locking
|
||||
* mechanism (see section FIXME in the docs). The method takes two function
|
||||
* pointers and a data value as its parameters. The arbitrary \a cb_data value
|
||||
* will be passed as argument on every callback. Asynchronous master access
|
||||
* (like EoE processing) is only possible if the callbacks have been set.
|
||||
*
|
||||
* The request_cb function must return zero, to allow another instance
|
||||
* (the EoE process for example) to access the master. Non-zero means,
|
||||
* that access is forbidden at this time.
|
||||
* (an EoE process for example) to access the master. Non-zero means,
|
||||
* that access is currently forbidden.
|
||||
*/
|
||||
void ecrt_master_callbacks(
|
||||
ec_master_t *master, /**< EtherCAT master */
|
||||
|
|
@ -357,7 +374,12 @@ void ecrt_master_callbacks(
|
|||
void *cb_data /**< Arbitrary user data. */
|
||||
);
|
||||
|
||||
/** Creates a new domain.
|
||||
/** Creates a new process data domain.
|
||||
*
|
||||
* For process data exchange, at least one process data domain is needed.
|
||||
* This method creates a new process data domain and returns a pointer to the
|
||||
* new domain object. This object can be used for registering Pdos and
|
||||
* exchanging them in cyclic operation.
|
||||
*
|
||||
* \return Pointer to the new domain on success, else NULL.
|
||||
*/
|
||||
|
|
@ -422,8 +444,11 @@ int ecrt_master_activate(
|
|||
|
||||
/** Sends all datagrams in the queue.
|
||||
*
|
||||
* This has to be called cyclically by the realtime application after
|
||||
* ecrt_master_activate() has returned.
|
||||
* 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.
|
||||
*/
|
||||
void ecrt_master_send(
|
||||
ec_master_t *master /**< EtherCAT master. */
|
||||
|
|
@ -431,7 +456,12 @@ void ecrt_master_send(
|
|||
|
||||
/** Fetches received frames from the hardware and processes the datagrams.
|
||||
*
|
||||
* This has to be called cyclically by the realtime application after
|
||||
* 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.
|
||||
*/
|
||||
void ecrt_master_receive(
|
||||
|
|
|
|||
|
|
@ -1195,6 +1195,8 @@ int ec_cdev_ioctl_config_sdo(
|
|||
* File operations
|
||||
*****************************************************************************/
|
||||
|
||||
/** Called when the cdev is opened.
|
||||
*/
|
||||
int eccdev_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
ec_cdev_t *cdev = container_of(inode->i_cdev, ec_cdev_t, cdev);
|
||||
|
|
@ -1208,6 +1210,8 @@ int eccdev_open(struct inode *inode, struct file *filp)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Called when the cdev is closed.
|
||||
*/
|
||||
int eccdev_release(struct inode *inode, struct file *filp)
|
||||
{
|
||||
ec_cdev_t *cdev = (ec_cdev_t *) filp->private_data;
|
||||
|
|
@ -1220,6 +1224,8 @@ int eccdev_release(struct inode *inode, struct file *filp)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Called when an ioctl() command is issued.
|
||||
*/
|
||||
long eccdev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
ec_cdev_t *cdev = (ec_cdev_t *) filp->private_data;
|
||||
|
|
|
|||
|
|
@ -277,6 +277,8 @@ int ec_domain_finish(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get the number of FMMU configurations of the domain.
|
||||
*/
|
||||
unsigned int ec_domain_fmmu_count(const ec_domain_t *domain)
|
||||
{
|
||||
const ec_fmmu_config_t *fmmu;
|
||||
|
|
@ -291,15 +293,17 @@ unsigned int ec_domain_fmmu_count(const ec_domain_t *domain)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get a certain FMMU configuration via its position in the list.
|
||||
*/
|
||||
const ec_fmmu_config_t *ec_domain_find_fmmu(
|
||||
const ec_domain_t *domain,
|
||||
unsigned int index
|
||||
const ec_domain_t *domain, /**< EtherCAT domain. */
|
||||
unsigned int pos /**< List position. */
|
||||
)
|
||||
{
|
||||
const ec_fmmu_config_t *fmmu;
|
||||
|
||||
list_for_each_entry(fmmu, &domain->fmmu_configs, list) {
|
||||
if (index--)
|
||||
if (pos--)
|
||||
continue;
|
||||
return fmmu;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -231,7 +231,11 @@ int ec_fsm_coe_success(ec_fsm_coe_t *fsm /**< Finite state machine */)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
/** Check if the received data are a CoE emergency request.
|
||||
*
|
||||
* If the check is positive, the emergency request is output.
|
||||
*
|
||||
* \return The data were an emergency request.
|
||||
*/
|
||||
int ec_fsm_coe_check_emergency(
|
||||
ec_fsm_coe_t *fsm, /**< Finite state machine */
|
||||
|
|
|
|||
|
|
@ -1072,6 +1072,10 @@ const ec_slave_t *ec_master_find_slave_const(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get the number of slave configurations provided by the application.
|
||||
*
|
||||
* \return Number of configurations.
|
||||
*/
|
||||
unsigned int ec_master_config_count(
|
||||
const ec_master_t *master /**< EtherCAT master. */
|
||||
)
|
||||
|
|
@ -1088,15 +1092,21 @@ unsigned int ec_master_config_count(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get a slave configuration via its position in the list.
|
||||
*
|
||||
* Const version.
|
||||
*
|
||||
* \return Slave configuration or \a NULL.
|
||||
*/
|
||||
const ec_slave_config_t *ec_master_get_config_const(
|
||||
const ec_master_t *master, /**< EtherCAT master. */
|
||||
unsigned int index /**< List position. */
|
||||
unsigned int pos /**< List position. */
|
||||
)
|
||||
{
|
||||
const ec_slave_config_t *sc;
|
||||
|
||||
list_for_each_entry(sc, &master->configs, list) {
|
||||
if (index--)
|
||||
if (pos--)
|
||||
continue;
|
||||
return sc;
|
||||
}
|
||||
|
|
@ -1106,6 +1116,10 @@ const ec_slave_config_t *ec_master_get_config_const(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get the number of domains.
|
||||
*
|
||||
* \return Number of domains.
|
||||
*/
|
||||
unsigned int ec_master_domain_count(
|
||||
const ec_master_t *master /**< EtherCAT master. */
|
||||
)
|
||||
|
|
@ -1136,6 +1150,10 @@ unsigned int ec_master_domain_count(
|
|||
return NULL; \
|
||||
} while (0)
|
||||
|
||||
/** Get a domain via its position in the list.
|
||||
*
|
||||
* \return Domain pointer, or \a NULL if not found.
|
||||
*/
|
||||
ec_domain_t *ec_master_find_domain(
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
unsigned int index /**< Domain index. */
|
||||
|
|
@ -1145,6 +1163,12 @@ ec_domain_t *ec_master_find_domain(
|
|||
EC_FIND_DOMAIN;
|
||||
}
|
||||
|
||||
/** Get a domain via its position in the list.
|
||||
*
|
||||
* Const version.
|
||||
*
|
||||
* \return Domain pointer, or \a NULL if not found.
|
||||
*/
|
||||
const ec_domain_t *ec_master_find_domain_const(
|
||||
const ec_master_t *master, /**< EtherCAT master. */
|
||||
unsigned int index /**< Domain index. */
|
||||
|
|
@ -1156,9 +1180,14 @@ const ec_domain_t *ec_master_find_domain_const(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Set the debug level.
|
||||
*
|
||||
* \retval 0 Success.
|
||||
* \retval -1 Invalid debug level.
|
||||
*/
|
||||
int ec_master_debug_level(
|
||||
ec_master_t *master,
|
||||
int level
|
||||
ec_master_t *master, /**< EtherCAT master. */
|
||||
int level /**< Debug level. May be 0, 1 or 2. */
|
||||
)
|
||||
{
|
||||
if (level < 0 || level > 2) {
|
||||
|
|
|
|||
|
|
@ -227,7 +227,9 @@ int ec_pdo_equal_entries(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
/** Get the number of Pdo entries.
|
||||
*
|
||||
* \return Number of Pdo entries.
|
||||
*/
|
||||
unsigned int ec_pdo_entry_count(
|
||||
const ec_pdo_t *pdo /**< Pdo. */
|
||||
|
|
|
|||
|
|
@ -299,7 +299,9 @@ const ec_pdo_t *ec_pdo_list_find_pdo_by_pos_const(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
/** Get the number of Pdos in the list.
|
||||
*
|
||||
* \return Number of Pdos.
|
||||
*/
|
||||
unsigned int ec_pdo_list_count(
|
||||
const ec_pdo_list_t *pl /**< Pdo list. */
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
struct ec_sdo;
|
||||
typedef struct ec_sdo ec_sdo_t;
|
||||
typedef struct ec_sdo ec_sdo_t; /**< \see ec_sdo. */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ struct ec_slave
|
|||
uint16_t base_fmmu_count; /**< Number of supported FMMUs. */
|
||||
|
||||
// data link status
|
||||
ec_slave_port_t ports[EC_MAX_PORTS];
|
||||
ec_slave_port_t ports[EC_MAX_PORTS]; /**< Port link status. */
|
||||
|
||||
// SII
|
||||
uint16_t *sii_words; /**< Complete SII image. */
|
||||
|
|
|
|||
|
|
@ -312,6 +312,10 @@ void ec_slave_config_load_default_mapping(
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** Get the number of Sdo configurations.
|
||||
*
|
||||
* \return Number of Sdo configurations.
|
||||
*/
|
||||
unsigned int ec_slave_config_sdo_count(
|
||||
const ec_slave_config_t *sc /**< Slave configuration. */
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue