diff --git a/include/ecdb.h b/include/ecdb.h index 8dc40a1cdb44eb1882083509afd6f48d619b40e9..1af254b5390b762845ffa84d718dc93a011edf70 100644 --- a/include/ecdb.h +++ b/include/ecdb.h @@ -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. */ diff --git a/include/ecrt.h b/include/ecrt.h index feda8859dc913de4b3b4dea2198ae51e60e86bb4..e8dbd6da7f5cf3358a4ecfdeb721ecf80f2af7fe 100644 --- a/include/ecrt.h +++ b/include/ecrt.h @@ -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) /*****************************************************************************/ diff --git a/master/canopen.c b/master/canopen.c index e062cdcfb4fcd1708ab969564eec3baf32f66c44..5a810b6ad74e0f059621c92aaada38168e842b02 100644 --- a/master/canopen.c +++ b/master/canopen.c @@ -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 diff --git a/master/canopen.h b/master/canopen.h index d218ba8bc7377ac03526cf46806aa832ac1eae30..c5693dae2cb9dafb7cd00245c2b57ecadff15b75 100644 --- a/master/canopen.h +++ b/master/canopen.h @@ -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; diff --git a/master/datagram.c b/master/datagram.c index 007cc5ea197c343f6fc299bb32bf70eb9754482e..50ab5afdfa61dd3ba82394d9aa89b870a6971365 100644 --- a/master/datagram.c +++ b/master/datagram.c @@ -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) diff --git a/master/device.h b/master/device.h index ad8c5f4858a909850cc94c830d8050cd77ed75b3..df59c20da662525ab08cc8d2ee21ea085431723a 100644 --- a/master/device.h +++ b/master/device.h @@ -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; diff --git a/master/fsm_coe_map.c b/master/fsm_coe_map.c index 9bb5e4399f3a466c012ffd94bdd8646f6a7bfd0c..d842c7df164b529af9a9d35ecf38357488cfeed6 100644 --- a/master/fsm_coe_map.c +++ b/master/fsm_coe_map.c @@ -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( diff --git a/master/fsm_coe_map.h b/master/fsm_coe_map.h index bbf306db6943729c8c4c05dfc40a933a99aa902e..b6820a497201c2cdcdf35c4061ada7fb0f1c1727 100644 --- a/master/fsm_coe_map.h +++ b/master/fsm_coe_map.h @@ -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; - - unsigned int sync_index; - ec_sdo_t *sync_sdo; - uint8_t sync_subindices; - uint16_t sync_subindex; - - struct list_head pdos; - ec_pdo_t *pdo; - ec_sdo_t *pdo_sdo; - uint8_t pdo_subindices; - uint16_t pdo_subindex; + ec_sdo_request_t request; /**< SDO request */ + + 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; /**< 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 */ }; /*****************************************************************************/ diff --git a/master/fsm_mapping.c b/master/fsm_mapping.c index 96d400d76f85b8fc016793bebc018f79067bab7a..a3eed9262d7da55dfc59db95552bb9dc77918090 100644 --- a/master/fsm_mapping.c +++ b/master/fsm_mapping.c @@ -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( diff --git a/master/fsm_mapping.h b/master/fsm_mapping.h index 68e3886a78afb380c660a0aca754ca3e4f4f0e5b..723e91753f1c5b9d541361b59bf00a9a45c18427 100644 --- a/master/fsm_mapping.h +++ b/master/fsm_mapping.h @@ -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 */ }; /*****************************************************************************/ diff --git a/master/fsm_master.c b/master/fsm_master.c index 6c0311d015d7766be93343ad7a8b4bb6016b0890..9a0deedb97feed9cbfe092ebf53a3079d649823f 100644 --- a/master/fsm_master.c +++ b/master/fsm_master.c @@ -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( diff --git a/master/fsm_master.h b/master/fsm_master.h index 5f95f31aa9b19f99a66216ac0c25048eec595152..9040abb5dc9c9f8052c6b655a3fd5e8abffbd7c2 100644 --- a/master/fsm_master.h +++ b/master/fsm_master.h @@ -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; diff --git a/master/fsm_sii.c b/master/fsm_sii.c index 18fa286046b93fefe0ed34bf8745ab8971737fa2..26c4af90bd37f7b061f764883f4b16d960782d7a 100644 --- a/master/fsm_sii.c +++ b/master/fsm_sii.c @@ -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 diff --git a/master/fsm_sii.h b/master/fsm_sii.h index f469ba55f51c28cd64297878c7e7cfeec2aaec38..5721f7c790c078ecd58841157d960166d7bff77c 100644 --- a/master/fsm_sii.h +++ b/master/fsm_sii.h @@ -48,6 +48,9 @@ /*****************************************************************************/ +/** + * SII access addressing mode. + */ typedef enum { EC_FSM_SII_POSITION, diff --git a/master/fsm_slave.c b/master/fsm_slave.c index 663a60ec828c7fc627814ca8438c259f44181a72..091a2c55966790b1297aa9e80b7f0709f85a88c6 100644 --- a/master/fsm_slave.c +++ b/master/fsm_slave.c @@ -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 */) diff --git a/master/fsm_slave.h b/master/fsm_slave.h index 9bb6fa3e6a5faf680d544425720a42da8a27992f..16b0c7e2d85a13ae03b76eec0d2aa17b914e8fca 100644 --- a/master/fsm_slave.h +++ b/master/fsm_slave.h @@ -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 */ diff --git a/master/globals.h b/master/globals.h index 00044b72a7d1a2e146a2795bac1b7fedc4213a71..faf1320093bfe83d74fee1f5d952140af8e07f22 100644 --- a/master/globals.h +++ b/master/globals.h @@ -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 */ /*****************************************************************************/ diff --git a/master/master.c b/master/master.c index f5268a0c44993156111dfb7541f21c7e84fd7c61..3f62f99a5b845fc930b4c6c063629687d52db112 100644 --- a/master/master.c +++ b/master/master.c @@ -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; diff --git a/master/master.h b/master/master.h index f11f858810da659e482b9a8404a55118c1860007..60d44b8bb8818da32f15221caf4c6ea2135d70c2 100644 --- a/master/master.h +++ b/master/master.h @@ -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 diff --git a/master/module.c b/master/module.c index 302fea10c70fea4174cf49141bef0f67722e196a..e5b1b46d9faf30e7f41af6226a86f39fd9b36f0d 100644 --- a/master/module.c +++ b/master/module.c @@ -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; diff --git a/master/slave.c b/master/slave.c index 71d5181c0bf3abdcf64cfb6208c75baa585dcf12..448c38edecbe6f42d3bac4c7d48e6d827a701816 100644 --- a/master/slave.c +++ b/master/slave.c @@ -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 */ diff --git a/master/slave.h b/master/slave.h index 392719ff4477893a2caf43efe773984c4fea13cf..e10942307eb9e3adedc7f7d6bf79f49adf6aa56e 100644 --- a/master/slave.h +++ b/master/slave.h @@ -83,6 +83,7 @@ ec_slave_state_t; /*****************************************************************************/ /** + * EtherCAT slave online state. */ typedef enum { diff --git a/master/sync.c b/master/sync.c index e0fc12739bdcca2895e9afe3050c15328b882a48..c9bc06bace4b766fadbb5073d2f1ddc97e1266c5 100644 --- a/master/sync.c +++ b/master/sync.c @@ -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( diff --git a/master/xmldev.c b/master/xmldev.c index d639e479538cd9bbd87fbfb7098c614ab41b1045..dc471f3b23b099af51a15e59acd174e831027ae7 100644 --- a/master/xmldev.c +++ b/master/xmldev.c @@ -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 */ + /*****************************************************************************/ diff --git a/master/xmldev.h b/master/xmldev.h index 2d70c9c5635da8819ba19fcdcf71814bae3f03cf..996c395850aa6bb6a8d8a4927e94ce452203ecca 100644 --- a/master/xmldev.h +++ b/master/xmldev.h @@ -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