diff -r 3b81d074735c -r 3778920f61e4 master/globals.h --- a/master/globals.h Thu Feb 14 09:18:55 2008 +0000 +++ b/master/globals.h Tue Feb 19 08:22:20 2008 +0000 @@ -31,10 +31,9 @@ * *****************************************************************************/ -/** - \file - Global definitions and macros. -*/ +/** \file + * Global definitions and macros. + */ /*****************************************************************************/ @@ -46,112 +45,121 @@ #include "../globals.h" /****************************************************************************** - * EtherCAT master + * EtherCAT master *****************************************************************************/ -/** clock frequency for the EoE state machines */ +/** Clock frequency for the EoE state machines. */ #define EC_EOE_FREQUENCY 1000 -/** datagram timeout in microseconds */ +/** Datagram timeout in microseconds. */ #define EC_IO_TIMEOUT 500 -/** number of state machine retries on datagram timeout */ +/** Number of state machine retries on datagram timeout. */ #define EC_FSM_RETRIES 3 /** Seconds to wait before fetching SDO dictionary after slave entered PREOP state. */ #define EC_WAIT_SDO_DICT 3 -/** minimum size of a buffer used with ec_state_string() */ +/** Minimum size of a buffer used with ec_state_string(). */ #define EC_STATE_STRING_SIZE 32 -/** maximum EEPROM size in words, to avoid infinite reading. */ +/** Maximum EEPROM size in words, to avoid infinite reading. */ #define EC_MAX_EEPROM_SIZE 1024 /****************************************************************************** - * EtherCAT protocol + * EtherCAT protocol *****************************************************************************/ -/** size of an EtherCAT frame header */ +/** Size of an EtherCAT frame header. */ #define EC_FRAME_HEADER_SIZE 2 -/** size of an EtherCAT datagram header */ +/** Size of an EtherCAT datagram header. */ #define EC_DATAGRAM_HEADER_SIZE 10 -/** size of an EtherCAT datagram footer */ +/** Size of an EtherCAT datagram footer. */ #define EC_DATAGRAM_FOOTER_SIZE 2 -/** size of the EtherCAT address field */ +/** Size of the EtherCAT address field. */ #define EC_ADDR_LEN 4 -/** resulting maximum data size of a single datagram in a frame */ +/** Resulting maximum data size of a single datagram in a frame. */ #define EC_MAX_DATA_SIZE (ETH_DATA_LEN - EC_FRAME_HEADER_SIZE \ - EC_DATAGRAM_HEADER_SIZE - EC_DATAGRAM_FOOTER_SIZE) -/** word offset of first EEPROM category. */ +/** Word offset of first EEPROM category. */ #define EC_FIRST_EEPROM_CATEGORY_OFFSET 0x40 -/*****************************************************************************/ - -/** - Convenience macro for printing EtherCAT-specific information to syslog. - This will print the message in \a fmt with a prefixed "EtherCAT: ". - \param fmt format string (like in printf()) - \param args arguments (optional) -*/ - +/** Size of a sync manager configuration page. */ +#define EC_SYNC_PAGE_SIZE 8 + +/** Maximum number of FMMUs per slave. */ +#define EC_MAX_FMMUS 16 + +/** Size of an FMMU configuration page. */ +#define EC_FMMU_PAGE_SIZE 16 + +/*****************************************************************************/ + +/** Convenience macro for printing EtherCAT-specific information to syslog. + * + * This will print the message in \a fmt with a prefixed "EtherCAT: ". + * + * \param fmt format string (like in printf()) + * \param args arguments (optional) + */ #define EC_INFO(fmt, args...) \ printk(KERN_INFO "EtherCAT: " fmt, ##args) -/** - Convenience macro for printing EtherCAT-specific errors to syslog. - This will print the message in \a fmt with a prefixed "EtherCAT ERROR: ". - \param fmt format string (like in printf()) - \param args arguments (optional) -*/ - +/** Convenience macro for printing EtherCAT-specific errors to syslog. + * + * This will print the message in \a fmt with a prefixed "EtherCAT ERROR: ". + * + * \param fmt format string (like in printf()) + * \param args arguments (optional) + */ #define EC_ERR(fmt, args...) \ printk(KERN_ERR "EtherCAT ERROR: " fmt, ##args) -/** - Convenience macro for printing EtherCAT-specific warnings to syslog. - This will print the message in \a fmt with a prefixed "EtherCAT WARNING: ". - \param fmt format string (like in printf()) - \param args arguments (optional) -*/ - +/** Convenience macro for printing EtherCAT-specific warnings to syslog. + * + * This will print the message in \a fmt with a prefixed "EtherCAT WARNING: ". + * + * \param fmt format string (like in printf()) + * \param args arguments (optional) + */ #define EC_WARN(fmt, args...) \ printk(KERN_WARNING "EtherCAT WARNING: " fmt, ##args) -/** - Convenience macro for printing EtherCAT debug messages to syslog. - This will print the message in \a fmt with a prefixed "EtherCAT DEBUG: ". - \param fmt format string (like in printf()) - \param args arguments (optional) -*/ - +/** Convenience macro for printing EtherCAT debug messages to syslog. + * + * This will print the message in \a fmt with a prefixed "EtherCAT DEBUG: ". + * + * \param fmt format string (like in printf()) + * \param args arguments (optional) + */ #define EC_DBG(fmt, args...) \ printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args) -/** - Convenience macro for defining read-only SysFS attributes. - This results in creating a static variable called attr_\a NAME. The SysFS - file will be world-readable. - \param NAME name of the attribute to create. -*/ - +/** Convenience macro for defining read-only SysFS attributes. + * + * This results in creating a static variable called attr_\a NAME. The SysFS + * file will be world-readable. + * + * \param NAME name of the attribute to create. + */ #define EC_SYSFS_READ_ATTR(NAME) \ static struct attribute attr_##NAME = { \ .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO \ } -/** - Convenience macro for defining read-write SysFS attributes. - This results in creating a static variable called attr_\a NAME. The SysFS - file will be word-readable plus owner-writable. - \param NAME name of the attribute to create. -*/ - +/** Convenience macro for defining read-write SysFS attributes. + * + * This results in creating a static variable called attr_\a NAME. The SysFS + * file will be word-readable plus owner-writable. + * + * \param NAME name of the attribute to create. + */ #define EC_SYSFS_READ_WRITE_ATTR(NAME) \ static struct attribute attr_##NAME = { \ .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO | S_IWUSR \ @@ -171,27 +179,22 @@ /*****************************************************************************/ -/** - Code - Message pair. - Some EtherCAT datagrams support reading a status code to display a certain - message. This type allows to map a code to a message string. -*/ - -typedef struct -{ - uint32_t code; /**< code */ - const char *message; /**< message belonging to \a code */ +/** Code - Message pair. + * + * Some EtherCAT datagrams support reading a status code to display a certain + * message. This type allows to map a code to a message string. + */ +typedef struct { + uint32_t code; /**< Code. */ + const char *message; /**< Message belonging to \a code. */ } ec_code_msg_t; /*****************************************************************************/ -/** - * Master request state. - */ - -typedef enum -{ +/** Master request state. + */ +typedef enum { EC_REQUEST_QUEUED, EC_REQUEST_IN_PROGRESS, EC_REQUEST_COMPLETE, @@ -201,6 +204,7 @@ /*****************************************************************************/ +typedef struct ec_slave ec_slave_t; /**< \see ec_slave. */ typedef struct ec_sdo ec_sdo_t; /**< \see ec_sdo */ /*****************************************************************************/