fp@39: /****************************************************************************** fp@0: * fp@54: * g l o b a l s . h fp@0: * fp@195: * Global definitions and macros. fp@0: * fp@39: * $Id$ fp@0: * fp@39: *****************************************************************************/ fp@0: fp@0: #ifndef _EC_GLOBALS_ fp@0: #define _EC_GLOBALS_ fp@0: fp@152: #include fp@152: fp@41: /*****************************************************************************/ fp@41: fp@73: // EtherCAT-Protokoll fp@195: #define EC_MAX_FRAME_SIZE 1500 /**< maximum size of an EtherCAT frame (without fp@195: header and CRC) */ fp@195: #define EC_MIN_FRAME_SIZE 46 /** ... minimum size */ fp@195: #define EC_FRAME_HEADER_SIZE 2 /**< size of an EtherCAT frame header */ fp@195: #define EC_COMMAND_HEADER_SIZE 10 /**< size of an EtherCAT command header */ fp@195: #define EC_COMMAND_FOOTER_SIZE 2 /**< size of an EtherCAT command footer */ fp@195: #define EC_SYNC_SIZE 8 /**< size of a sync manager configuration page */ fp@195: #define EC_FMMU_SIZE 16 /**< size of an FMMU configuration page */ fp@195: #define EC_MAX_FMMUS 16 /**< maximum number of FMMUs per slave */ fp@90: #define EC_MAX_DATA_SIZE (EC_MAX_FRAME_SIZE \ fp@90: - EC_FRAME_HEADER_SIZE \ fp@90: - EC_COMMAND_HEADER_SIZE \ fp@195: - EC_COMMAND_FOOTER_SIZE) /**< maximum data size of a fp@195: single command */ fp@0: fp@152: /*****************************************************************************/ fp@152: fp@84: #define EC_INFO(fmt, args...) \ fp@84: printk(KERN_INFO "EtherCAT: " fmt, ##args) fp@84: #define EC_ERR(fmt, args...) \ fp@84: printk(KERN_ERR "EtherCAT ERROR: " fmt, ##args) fp@84: #define EC_WARN(fmt, args...) \ fp@84: printk(KERN_WARNING "EtherCAT WARNING: " fmt, ##args) fp@84: #define EC_DBG(fmt, args...) \ fp@84: printk(KERN_DEBUG "EtherCAT DEBUG: " fmt, ##args) fp@84: fp@184: #define EC_LIT(X) #X fp@184: #define EC_STR(X) EC_LIT(X) fp@184: fp@184: #define EC_SYSFS_READ_ATTR(NAME) \ fp@184: static struct attribute attr_##NAME = { \ fp@184: .name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO \ fp@184: } fp@184: fp@41: /*****************************************************************************/ fp@41: fp@152: extern void ec_print_data(const uint8_t *, size_t); fp@152: extern void ec_print_data_diff(const uint8_t *, const uint8_t *, size_t); fp@152: fp@152: /*****************************************************************************/ fp@152: fp@164: /** fp@195: Code - Message pair. fp@164: Some EtherCAT commands support reading a status code to display a certain fp@164: message. This type allows to map a code to a message string. fp@164: */ fp@164: fp@164: typedef struct fp@164: { fp@195: uint32_t code; /**< code */ fp@195: const char *message; /**< message belonging to \a code */ fp@164: } fp@164: ec_code_msg_t; fp@164: fp@164: /*****************************************************************************/ fp@164: fp@0: #endif fp@73: