fp@0: //--------------------------------------------------------------- fp@0: // fp@0: // e c _ s l a v e . h fp@0: // fp@0: // $LastChangedDate$ fp@0: // $Author$ fp@0: // fp@0: //--------------------------------------------------------------- fp@0: fp@0: #define SIMPLE 0 fp@0: #define MAILBOX 1 fp@0: fp@0: //--------------------------------------------------------------- fp@0: fp@0: typedef struct slave_desc EtherCAT_slave_desc_t; fp@0: fp@0: typedef struct fp@0: { fp@0: // Base data fp@0: unsigned char type; fp@0: unsigned char revision; fp@0: unsigned short build; fp@0: fp@0: // Addresses fp@0: short ring_position; fp@0: unsigned short station_address; fp@0: fp@0: // Slave information interface fp@0: unsigned int vendor_id; fp@0: unsigned int product_code; fp@0: unsigned int revision_number; fp@0: fp@0: const EtherCAT_slave_desc_t *desc; fp@0: fp@0: unsigned int logical_address0; fp@0: fp@0: unsigned int current_state; fp@0: unsigned int requested_state; fp@0: fp@0: unsigned char *process_data; fp@0: } fp@0: EtherCAT_slave_t; fp@0: fp@0: #define ECAT_INIT_SLAVE(TYPE) {0, 0, 0, 0, 0, 0, 0, 0, TYPE, 0, 0, 0, NULL} fp@0: fp@0: //--------------------------------------------------------------- fp@0: fp@0: // Slave construction and deletion fp@0: void EtherCAT_slave_init(EtherCAT_slave_t *); fp@0: void EtherCAT_slave_clear(EtherCAT_slave_t *); fp@0: fp@0: // Debug fp@0: void EtherCAT_slave_print(EtherCAT_slave_t *); fp@0: fp@0: //--------------------------------------------------------------- fp@0: fp@0: typedef struct slave_desc fp@0: { fp@0: const char *vendor_name; fp@0: const char *product_name; fp@0: const char *product_desc; fp@0: fp@0: const int type; fp@0: fp@0: const unsigned char *sm0; fp@0: const unsigned char *sm1; fp@0: const unsigned char *sm2; fp@0: const unsigned char *sm3; fp@0: fp@0: const unsigned char *fmmu0; fp@0: fp@0: const unsigned int data_length; fp@0: } fp@0: EtherCAT_slave_desc_t; fp@0: fp@0: extern EtherCAT_slave_desc_t Beckhoff_EK1100[]; fp@0: extern EtherCAT_slave_desc_t Beckhoff_EL1014[]; fp@0: extern EtherCAT_slave_desc_t Beckhoff_EL2004[]; fp@0: extern EtherCAT_slave_desc_t Beckhoff_EL3102[]; fp@0: extern EtherCAT_slave_desc_t Beckhoff_EL3162[]; fp@0: extern EtherCAT_slave_desc_t Beckhoff_EL4102[]; fp@0: extern EtherCAT_slave_desc_t Beckhoff_EL5001[]; fp@0: fp@0: //--------------------------------------------------------------- fp@0: fp@0: struct slave_ident fp@0: { fp@0: const unsigned int vendor_id; fp@0: const unsigned int product_code; fp@0: const EtherCAT_slave_desc_t *desc; fp@0: }; fp@0: fp@0: extern struct slave_ident slave_idents[]; fp@0: extern unsigned int slave_idents_count; fp@0: fp@0: //---------------------------------------------------------------