mirror of
https://gitlab.com/etherlab.org/ethercat.git
synced 2026-02-06 11:51:45 +08:00
Updated Doxygen documentation.
This commit is contained in:
@@ -35,8 +35,8 @@
|
||||
\file
|
||||
EtherCAT Slave Database.
|
||||
|
||||
\warn Please do not create any dependencies to this file! It may be changed
|
||||
between releases. Provide a copy, if you want to use it in foreign
|
||||
\attention Please do not create any dependencies to this file! It may be
|
||||
changed between releases. Provide a copy, if you want to use it in foreign
|
||||
projects.
|
||||
*/
|
||||
|
||||
|
||||
@@ -59,10 +59,24 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* EtherCAT real-time interface major version number.
|
||||
*/
|
||||
#define ECRT_VER_MAJOR 1
|
||||
|
||||
/**
|
||||
* EtherCAT real-time interface minor version number.
|
||||
*/
|
||||
#define ECRT_VER_MINOR 3
|
||||
|
||||
/**
|
||||
* EtherCAT real-time interface version word generator.
|
||||
*/
|
||||
#define ECRT_VERSION(a,b) (((a) << 8) + (b))
|
||||
|
||||
/**
|
||||
* EtherCAT real-time interface version word.
|
||||
*/
|
||||
#define ECRT_VERSION_MAGIC ECRT_VERSION(ECRT_VER_MAJOR, ECRT_VER_MINOR)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -171,9 +171,14 @@ void ec_sdo_clear(struct kobject *kobj /**< SDO's kobject */)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Get and SDO entry from an SDO via its subindex.
|
||||
* \return pointer to SDO entry, or NULL.
|
||||
*/
|
||||
|
||||
ec_sdo_entry_t *ec_sdo_get_entry(
|
||||
ec_sdo_t *sdo,
|
||||
uint8_t subindex
|
||||
ec_sdo_t *sdo, /**< SDO */
|
||||
uint8_t subindex /**< entry subindex */
|
||||
)
|
||||
{
|
||||
ec_sdo_entry_t *entry;
|
||||
@@ -188,6 +193,11 @@ ec_sdo_entry_t *ec_sdo_get_entry(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Print SDO information to a buffer.
|
||||
* /return size of bytes written to buffer.
|
||||
*/
|
||||
|
||||
ssize_t ec_sdo_info(ec_sdo_t *sdo, /**< SDO */
|
||||
char *buffer /**< target buffer */
|
||||
)
|
||||
@@ -203,6 +213,11 @@ ssize_t ec_sdo_info(ec_sdo_t *sdo, /**< SDO */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Show an SDO as Sysfs attribute.
|
||||
* /return size of bytes written to buffer.
|
||||
*/
|
||||
|
||||
ssize_t ec_show_sdo_attribute(struct kobject *kobj, /**< kobject */
|
||||
struct attribute *attr,
|
||||
char *buffer
|
||||
@@ -285,6 +300,11 @@ void ec_sdo_entry_clear(struct kobject *kobj /**< SDO entry's kobject */)
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Print SDO entry information to a buffer.
|
||||
* \return number of bytes written.
|
||||
*/
|
||||
|
||||
ssize_t ec_sdo_entry_info(ec_sdo_entry_t *entry, /**< SDO entry */
|
||||
char *buffer /**< target buffer */
|
||||
@@ -303,6 +323,11 @@ ssize_t ec_sdo_entry_info(ec_sdo_entry_t *entry, /**< SDO entry */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Format entry data based on the CANopen data type and print it to a buffer.
|
||||
* \return number of bytes written.
|
||||
*/
|
||||
|
||||
ssize_t ec_sdo_entry_format_data(ec_sdo_entry_t *entry, /**< SDO entry */
|
||||
ec_sdo_request_t *request, /**< SDO request */
|
||||
char *buffer /**< target buffer */
|
||||
@@ -376,6 +401,13 @@ raw_data:
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Start SDO entry reading.
|
||||
* This function blocks, until reading is finished, and is interruptible as
|
||||
* long as the master state machine has not begun with reading.
|
||||
* \return number of bytes written to buffer, or error code.
|
||||
*/
|
||||
|
||||
ssize_t ec_sdo_entry_read_value(ec_sdo_entry_t *entry, /**< SDO entry */
|
||||
char *buffer /**< target buffer */
|
||||
)
|
||||
@@ -419,6 +451,11 @@ ssize_t ec_sdo_entry_read_value(ec_sdo_entry_t *entry, /**< SDO entry */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Show an SDO entry as Sysfs attribute.
|
||||
* /return size of bytes written to buffer.
|
||||
*/
|
||||
|
||||
ssize_t ec_show_sdo_entry_attribute(struct kobject *kobj, /**< kobject */
|
||||
struct attribute *attr,
|
||||
char *buffer
|
||||
|
||||
@@ -108,10 +108,10 @@ ec_sdo_data_t;
|
||||
typedef struct
|
||||
{
|
||||
struct list_head list; /**< list item */
|
||||
ec_sdo_entry_t *entry;
|
||||
ec_sdo_entry_t *entry; /**< SDO entry */
|
||||
uint8_t *data; /**< pointer to SDO data */
|
||||
size_t size; /**< size of SDO data */
|
||||
ec_request_state_t state;
|
||||
ec_request_state_t state; /**< SDO request state */
|
||||
}
|
||||
ec_sdo_request_t;
|
||||
|
||||
|
||||
@@ -309,7 +309,7 @@ int ec_datagram_lrw(ec_datagram_t *datagram,
|
||||
*/
|
||||
|
||||
void ec_datagram_print_wc_error(
|
||||
const ec_datagram_t *datagram
|
||||
const ec_datagram_t *datagram /**< EtherCAT datagram */
|
||||
)
|
||||
{
|
||||
if (datagram->working_counter == 0)
|
||||
|
||||
@@ -47,6 +47,12 @@
|
||||
#include "../devices/ecdev.h"
|
||||
#include "globals.h"
|
||||
|
||||
/**
|
||||
* Size of the transmit ring.
|
||||
* This memory ring is used to transmit frames. It is necessary to use
|
||||
* different memory regions, because otherwise the network device DMA could
|
||||
* send the same data twice, if it is called twice.
|
||||
*/
|
||||
#define EC_TX_RING_SIZE 2
|
||||
|
||||
#ifdef EC_DEBUG_IF
|
||||
@@ -87,7 +93,7 @@ struct ec_device
|
||||
uint8_t open; /**< true, if the net_device has been opened */
|
||||
uint8_t link_state; /**< device link state */
|
||||
struct sk_buff *tx_skb[EC_TX_RING_SIZE]; /**< transmit skb ring */
|
||||
unsigned int tx_ring_index;
|
||||
unsigned int tx_ring_index; /**< last ring entry used to transmit */
|
||||
cycles_t cycles_poll; /**< cycles of last poll */
|
||||
#ifdef EC_DEBUG_RING
|
||||
struct timeval timeval_poll;
|
||||
|
||||
@@ -69,7 +69,7 @@ void ec_fsm_coe_map_clear_pdos(ec_fsm_coe_map_t *);
|
||||
|
||||
void ec_fsm_coe_map_init(
|
||||
ec_fsm_coe_map_t *fsm, /**< finite state machine */
|
||||
ec_fsm_coe_t *fsm_coe /*< CoE state machine to use */
|
||||
ec_fsm_coe_t *fsm_coe /**< CoE state machine to use */
|
||||
)
|
||||
{
|
||||
fsm->state = NULL;
|
||||
@@ -91,6 +91,7 @@ void ec_fsm_coe_map_clear(ec_fsm_coe_map_t *fsm /**< finite state machine */)
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Clear FSM PDOs.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_clear_pdos(
|
||||
@@ -154,6 +155,7 @@ int ec_fsm_coe_map_success(ec_fsm_coe_map_t *fsm /**< Finite state machine */)
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Start reading mapping.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_state_start(
|
||||
@@ -168,6 +170,7 @@ void ec_fsm_coe_map_state_start(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Read mapping of next sync manager.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_action_next_sync(
|
||||
@@ -208,6 +211,7 @@ void ec_fsm_coe_map_action_next_sync(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Count mapped PDOs.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_state_pdo_count(
|
||||
@@ -236,6 +240,7 @@ void ec_fsm_coe_map_state_pdo_count(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Read next PDO.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_action_next_pdo(
|
||||
@@ -282,6 +287,7 @@ void ec_fsm_coe_map_action_next_pdo(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Fetch PDO information.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_state_pdo(
|
||||
@@ -362,6 +368,7 @@ void ec_fsm_coe_map_state_pdo(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Read number of PDO entries.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_state_pdo_entry_count(
|
||||
@@ -390,6 +397,7 @@ void ec_fsm_coe_map_state_pdo_entry_count(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Read next PDO entry.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_action_next_pdo_entry(
|
||||
@@ -423,6 +431,7 @@ void ec_fsm_coe_map_action_next_pdo_entry(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Read PDO entry information.
|
||||
*/
|
||||
|
||||
void ec_fsm_coe_map_state_pdo_entry(
|
||||
|
||||
@@ -59,18 +59,18 @@ struct ec_fsm_coe_map
|
||||
ec_fsm_coe_t *fsm_coe; /**< CoE state machine to use */
|
||||
|
||||
ec_slave_t *slave; /**< EtherCAT slave */
|
||||
ec_sdo_request_t request;
|
||||
ec_sdo_request_t request; /**< SDO request */
|
||||
|
||||
unsigned int sync_index;
|
||||
ec_sdo_t *sync_sdo;
|
||||
uint8_t sync_subindices;
|
||||
uint16_t sync_subindex;
|
||||
unsigned int sync_index; /**< index of the current sync manager */
|
||||
ec_sdo_t *sync_sdo; /**< pointer to the sync managers mapping SDO */
|
||||
uint8_t sync_subindices; /**< number of mapped PDOs */
|
||||
uint16_t sync_subindex; /**< current subindex in mapping SDO */
|
||||
|
||||
struct list_head pdos;
|
||||
ec_pdo_t *pdo;
|
||||
ec_sdo_t *pdo_sdo;
|
||||
uint8_t pdo_subindices;
|
||||
uint16_t pdo_subindex;
|
||||
struct list_head pdos; /**< list of mapped PDOs */
|
||||
ec_pdo_t *pdo; /**< current PDO */
|
||||
ec_sdo_t *pdo_sdo; /**< current PDO SDO */
|
||||
uint8_t pdo_subindices; /**< number of PDO entries */
|
||||
uint16_t pdo_subindex; /**< current subindex in PDO SDO */
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -138,10 +138,11 @@ int ec_fsm_mapping_success(
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* PDO mapping state machine
|
||||
* state functions
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Start mapping configuration.
|
||||
*/
|
||||
|
||||
void ec_fsm_mapping_state_start(
|
||||
@@ -155,6 +156,7 @@ void ec_fsm_mapping_state_start(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Process mapping of next sync manager.
|
||||
*/
|
||||
|
||||
void ec_fsm_mapping_next_sync(
|
||||
@@ -200,6 +202,7 @@ void ec_fsm_mapping_next_sync(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Process mapping of next PDO.
|
||||
*/
|
||||
|
||||
ec_pdo_t *ec_fsm_mapping_next_pdo(
|
||||
@@ -223,6 +226,7 @@ ec_pdo_t *ec_fsm_mapping_next_pdo(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Set the number of mapped PDOs to zero.
|
||||
*/
|
||||
|
||||
void ec_fsm_mapping_state_zero_count(
|
||||
@@ -268,6 +272,7 @@ void ec_fsm_mapping_state_zero_count(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Add a PDO to the sync managers mapping.
|
||||
*/
|
||||
|
||||
void ec_fsm_mapping_state_add_pdo(
|
||||
@@ -318,6 +323,7 @@ void ec_fsm_mapping_state_add_pdo(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Set the number of mapped PDOs.
|
||||
*/
|
||||
|
||||
void ec_fsm_mapping_state_pdo_count(
|
||||
|
||||
@@ -66,7 +66,7 @@ struct ec_fsm_mapping
|
||||
ec_pdo_t *pdo; /**< current PDO */
|
||||
ec_sdo_data_t sdodata; /**< SDO configuration data */
|
||||
uint16_t sdo_value; /**< SDO value */
|
||||
unsigned int pdo_count;
|
||||
unsigned int pdo_count; /**< number of mapped PDOs */
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -417,6 +417,7 @@ int ec_fsm_master_action_process_sdo(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Check for slaves that are not configured and configure them.
|
||||
*/
|
||||
|
||||
int ec_fsm_master_action_configure(
|
||||
@@ -1029,6 +1030,7 @@ void ec_fsm_master_state_sdodict(ec_fsm_master_t *fsm /**< master state machine
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Scan the PDO mapping of a slave.
|
||||
*/
|
||||
|
||||
void ec_fsm_master_state_pdomap(
|
||||
|
||||
@@ -58,12 +58,12 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
struct list_head list;
|
||||
ec_slave_t *slave;
|
||||
off_t word_offset;
|
||||
size_t word_size;
|
||||
const uint8_t *data;
|
||||
ec_request_state_t state;
|
||||
struct list_head list; /**< list head */
|
||||
ec_slave_t *slave; /**< EtherCAT slave */
|
||||
off_t word_offset; /**< SII address in words */
|
||||
size_t word_size; /**< data size in words */
|
||||
const uint8_t *data; /**< pointer to the data */
|
||||
ec_request_state_t state; /**< state of the request */
|
||||
}
|
||||
ec_eeprom_write_request_t;
|
||||
|
||||
|
||||
@@ -43,8 +43,15 @@
|
||||
#include "master.h"
|
||||
#include "fsm_sii.h"
|
||||
|
||||
#define EEPROM_TIMEOUT 10 // read/write timeout [ms]
|
||||
#define EEPROM_INHIBIT 5 // time before evaluating answer at writing [ms]
|
||||
/**
|
||||
* Read/Write timeout. [ms]
|
||||
*/
|
||||
#define EEPROM_TIMEOUT 10
|
||||
|
||||
/**
|
||||
* Time before evaluating answer at writing. [ms]
|
||||
*/
|
||||
#define EEPROM_INHIBIT 5
|
||||
|
||||
//#define SII_DEBUG
|
||||
|
||||
|
||||
@@ -48,6 +48,9 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* SII access addressing mode.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
EC_FSM_SII_POSITION,
|
||||
|
||||
@@ -697,6 +697,7 @@ void ec_fsm_slave_conf_state_clear_fmmus(ec_fsm_slave_t *fsm
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Check for mailbox sync managers to be configured.
|
||||
*/
|
||||
|
||||
void ec_fsm_slave_conf_enter_mbox_sync(
|
||||
@@ -810,6 +811,7 @@ void ec_fsm_slave_conf_state_mbox_sync(ec_fsm_slave_t *fsm /**< slave state mach
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Request PREOP state.
|
||||
*/
|
||||
|
||||
void ec_fsm_slave_conf_enter_preop(ec_fsm_slave_t *fsm /**< slave state machine */)
|
||||
@@ -861,6 +863,7 @@ void ec_fsm_slave_conf_state_preop(ec_fsm_slave_t *fsm /**< slave state machine
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Check for SDO configurations to be applied.
|
||||
*/
|
||||
|
||||
void ec_fsm_slave_conf_enter_sdoconf(ec_fsm_slave_t *fsm /**< slave state machine */)
|
||||
@@ -916,6 +919,7 @@ void ec_fsm_slave_conf_state_sdoconf(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Check for alternative PDO mappings to be applied.
|
||||
*/
|
||||
|
||||
void ec_fsm_slave_conf_enter_mapconf(
|
||||
@@ -962,6 +966,7 @@ void ec_fsm_slave_conf_state_mapconf(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Check for PDO sync managers to be configured.
|
||||
*/
|
||||
|
||||
void ec_fsm_slave_conf_enter_pdo_sync(
|
||||
@@ -994,6 +999,7 @@ void ec_fsm_slave_conf_enter_pdo_sync(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Configure PDO sync managers.
|
||||
*/
|
||||
|
||||
void ec_fsm_slave_conf_state_pdo_sync(ec_fsm_slave_t *fsm /**< slave state machine */)
|
||||
@@ -1027,7 +1033,8 @@ void ec_fsm_slave_conf_state_pdo_sync(ec_fsm_slave_t *fsm /**< slave state machi
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
*/
|
||||
* Check for FMMUs to be configured.
|
||||
*/
|
||||
|
||||
void ec_fsm_slave_conf_enter_fmmu(ec_fsm_slave_t *fsm /**< slave state machine */)
|
||||
{
|
||||
@@ -1089,6 +1096,7 @@ void ec_fsm_slave_conf_state_fmmu(ec_fsm_slave_t *fsm /**< slave state machine *
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Request SAVEOP state.
|
||||
*/
|
||||
|
||||
void ec_fsm_slave_conf_enter_saveop(ec_fsm_slave_t *fsm /**< slave state machine */)
|
||||
|
||||
@@ -66,7 +66,7 @@ struct ec_fsm_slave
|
||||
|
||||
void (*state)(ec_fsm_slave_t *); /**< state function */
|
||||
ec_sdo_data_t *sdodata; /**< SDO configuration data */
|
||||
uint16_t sii_offset;
|
||||
uint16_t sii_offset; /**< SII offset in words */
|
||||
|
||||
ec_fsm_sii_t fsm_sii; /**< SII state machine */
|
||||
ec_fsm_change_t fsm_change; /**< State change state machine */
|
||||
|
||||
@@ -201,7 +201,7 @@ ec_request_state_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
typedef struct ec_sdo ec_sdo_t;
|
||||
typedef struct ec_sdo ec_sdo_t; /**< \see ec_sdo */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
||||
@@ -57,13 +57,11 @@
|
||||
/*****************************************************************************/
|
||||
|
||||
void ec_master_destroy_domains(ec_master_t *);
|
||||
void ec_master_sync_io(ec_master_t *);
|
||||
static int ec_master_idle_thread(ec_master_t *);
|
||||
static int ec_master_operation_thread(ec_master_t *);
|
||||
#ifdef EC_EOE
|
||||
void ec_master_eoe_run(unsigned long);
|
||||
#endif
|
||||
void ec_master_check_sdo(unsigned long);
|
||||
ssize_t ec_show_master_attribute(struct kobject *, struct attribute *, char *);
|
||||
ssize_t ec_store_master_attribute(struct kobject *, struct attribute *,
|
||||
const char *, size_t);
|
||||
@@ -917,10 +915,15 @@ schedule:
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Prints the device information to a buffer.
|
||||
* \return number of bytes written.
|
||||
*/
|
||||
|
||||
ssize_t ec_master_device_info(
|
||||
const ec_device_t *device,
|
||||
const uint8_t *mac,
|
||||
char *buffer
|
||||
const ec_device_t *device, /**< EtherCAT device */
|
||||
const uint8_t *mac, /**< MAC address */
|
||||
char *buffer /**< target buffer */
|
||||
)
|
||||
{
|
||||
unsigned int frames_lost;
|
||||
|
||||
@@ -132,7 +132,7 @@ struct ec_master
|
||||
|
||||
int debug_level; /**< master debug level */
|
||||
ec_stats_t stats; /**< cyclic statistics */
|
||||
unsigned int pdo_slaves_offline; /** number of slaves, for which PDOs
|
||||
unsigned int pdo_slaves_offline; /**< number of slaves, for which PDOs
|
||||
were registered and that are offline
|
||||
(used for bus status) */
|
||||
unsigned int frames_timed_out; /**< there were frame timeouts in the last
|
||||
|
||||
@@ -75,7 +75,7 @@ static uint8_t macs[MAX_MASTERS][2][ETH_ALEN]; /**< MAC addresses */
|
||||
static dev_t device_number; /**< XML character device number */
|
||||
ec_xmldev_t xmldev; /**< XML character device */
|
||||
|
||||
char *ec_master_version_str = EC_MASTER_VERSION;
|
||||
char *ec_master_version_str = EC_MASTER_VERSION; /**< master version string */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -207,6 +207,10 @@ void __exit ec_cleanup_module(void)
|
||||
* MAC address functions
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* \return true, if two MAC addresses are equal.
|
||||
*/
|
||||
|
||||
int ec_mac_equal(const uint8_t *mac1, const uint8_t *mac2)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -220,7 +224,15 @@ int ec_mac_equal(const uint8_t *mac1, const uint8_t *mac2)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
ssize_t ec_mac_print(const uint8_t *mac, char *buffer)
|
||||
/**
|
||||
* Print a MAC address to a buffer.
|
||||
* \return number of bytes written.
|
||||
*/
|
||||
|
||||
ssize_t ec_mac_print(
|
||||
const uint8_t *mac, /**< MAC address */
|
||||
char *buffer /**< target buffer */
|
||||
)
|
||||
{
|
||||
off_t off = 0;
|
||||
unsigned int i;
|
||||
@@ -235,6 +247,10 @@ ssize_t ec_mac_print(const uint8_t *mac, char *buffer)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* \return true, if the MAC address is all-zero.
|
||||
*/
|
||||
|
||||
int ec_mac_is_zero(const uint8_t *mac)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -248,6 +264,10 @@ int ec_mac_is_zero(const uint8_t *mac)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* \return true, if the given MAC address is the broadcast address.
|
||||
*/
|
||||
|
||||
int ec_mac_is_broadcast(const uint8_t *mac)
|
||||
{
|
||||
unsigned int i;
|
||||
@@ -261,6 +281,13 @@ int ec_mac_is_broadcast(const uint8_t *mac)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Parse a MAC address from a string.
|
||||
* The MAC address must follow the regexp
|
||||
* "([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}".
|
||||
\return 0 on success, else < 0
|
||||
*/
|
||||
|
||||
static int ec_mac_parse(uint8_t *mac, const char *src, int allow_empty)
|
||||
{
|
||||
unsigned int i, value;
|
||||
|
||||
@@ -282,7 +282,8 @@ void ec_slave_clear(struct kobject *kobj /**< kobject of the slave */)
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
*/
|
||||
* SDO kobject clear method.
|
||||
*/
|
||||
|
||||
void ec_slave_sdos_clear(struct kobject *kobj /**< kobject for SDOs */)
|
||||
{
|
||||
@@ -374,6 +375,7 @@ void ec_slave_set_online_state(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Request a slave state and resets the error flag.
|
||||
*/
|
||||
|
||||
void ec_slave_request_state(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
@@ -875,7 +877,9 @@ size_t ec_slave_info(const ec_slave_t *slave, /**< EtherCAT slave */
|
||||
* \return 0 case of success, otherwise error code.
|
||||
*/
|
||||
|
||||
int ec_slave_schedule_eeprom_writing(ec_eeprom_write_request_t *request)
|
||||
int ec_slave_schedule_eeprom_writing(
|
||||
ec_eeprom_write_request_t *request /**< EEPROM write request */
|
||||
)
|
||||
{
|
||||
ec_master_t *master = request->slave->master;
|
||||
|
||||
@@ -924,7 +928,10 @@ int ec_slave_schedule_eeprom_writing(ec_eeprom_write_request_t *request)
|
||||
* \return CRC8
|
||||
*/
|
||||
|
||||
uint8_t ec_slave_eeprom_crc(const uint8_t *data, size_t length)
|
||||
uint8_t ec_slave_eeprom_crc(
|
||||
const uint8_t *data, /**< pointer to data */
|
||||
size_t length /**< number of bytes in \a data */
|
||||
)
|
||||
{
|
||||
unsigned int i;
|
||||
uint8_t bit, byte, crc = 0x48;
|
||||
@@ -1179,6 +1186,8 @@ ssize_t ec_store_slave_attribute(struct kobject *kobj, /**< slave's kobject */
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Get the sync manager for either Rx- or Tx-PDOs.
|
||||
* \return pointer to sync manager, or NULL.
|
||||
*/
|
||||
|
||||
ec_sync_t *ec_slave_get_pdo_sync(
|
||||
@@ -1372,6 +1381,10 @@ int ecrt_slave_conf_sdo32(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Clear slave's PDO mapping.
|
||||
*/
|
||||
|
||||
void ecrt_slave_pdo_mapping_clear(
|
||||
ec_slave_t *slave, /**< EtherCAT slave */
|
||||
ec_direction_t dir /**< output/input */
|
||||
@@ -1393,10 +1406,14 @@ void ecrt_slave_pdo_mapping_clear(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Add a PDO to the list of known mapped PDOs.
|
||||
*/
|
||||
|
||||
int ecrt_slave_pdo_mapping_add(
|
||||
ec_slave_t *slave, /**< EtherCAT slave */
|
||||
ec_direction_t dir, /**< input/output */
|
||||
uint16_t pdo_index /**< Index of PDO mapping list */)
|
||||
uint16_t pdo_index /**< Index of mapped PDO */)
|
||||
{
|
||||
ec_pdo_t *pdo;
|
||||
ec_sync_t *sync;
|
||||
@@ -1444,6 +1461,11 @@ int ecrt_slave_pdo_mapping_add(
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Convenience function for ecrt_slave_pdo_mapping_clear() and
|
||||
* ecrt_slave_pdo_mapping_add().
|
||||
*/
|
||||
|
||||
int ecrt_slave_pdo_mapping(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
ec_direction_t dir, /**< input/output */
|
||||
unsigned int num_args, /**< Number of following arguments */
|
||||
|
||||
@@ -83,6 +83,7 @@ ec_slave_state_t;
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* EtherCAT slave online state.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -140,6 +140,8 @@ void ec_sync_config(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Adds a PDO to the list of known mapped PDOs.
|
||||
* \return 0 on success, else < 0
|
||||
*/
|
||||
|
||||
int ec_sync_add_pdo(
|
||||
@@ -178,6 +180,7 @@ int ec_sync_add_pdo(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Clears the list of known mapped PDOs.
|
||||
*/
|
||||
|
||||
void ec_sync_clear_pdos(
|
||||
@@ -197,6 +200,7 @@ void ec_sync_clear_pdos(
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
* \return Type of PDOs covered by the given sync manager.
|
||||
*/
|
||||
|
||||
ec_pdo_type_t ec_sync_get_pdo_type(
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \cond */
|
||||
|
||||
static char *test_str = "hello world!\n";
|
||||
|
||||
int ecxmldev_open(struct inode *, struct file *);
|
||||
@@ -169,4 +171,6 @@ ssize_t ecxmldev_write(struct file *filp,
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
@@ -63,11 +63,15 @@ ec_xmldev_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \cond */
|
||||
|
||||
int ec_xmldev_init(ec_xmldev_t *, ec_master_t *, dev_t);
|
||||
void ec_xmldev_clear(ec_xmldev_t *);
|
||||
|
||||
int ec_xmldev_request(ec_xmldev_t *, uint32_t, uint32_t);
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user