fp@0: /**************************************************************** fp@0: * fp@0: * e c _ t y p e s . c fp@0: * fp@0: * EtherCAT-Slave-Typen. fp@0: * fp@0: * $Date: 2005-09-07 17:50:50 +0200 (Mit, 07 Sep 2005) $ fp@0: * $Author: fp $ fp@0: * fp@0: ***************************************************************/ fp@0: fp@24: #include fp@24: fp@0: #include "ec_globals.h" fp@0: #include "ec_types.h" fp@0: fp@0: /***************************************************************/ fp@0: fp@0: unsigned char sm0_multi[] = {0x00, 0x18, 0xF6, 0x00, 0x26, 0x00, 0x01, 0x00}; fp@0: unsigned char sm1_multi[] = {0xF6, 0x18, 0xF6, 0x00, 0x22, 0x00, 0x01, 0x00}; fp@0: fp@0: unsigned char sm0_1014[] = {0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00}; fp@0: fp@0: unsigned char sm0_2004[] = {0x00, 0x0F, 0x01, 0x00, 0x46, 0x00, 0x01, 0x00}; fp@0: fp@0: unsigned char sm2_31xx[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x00, 0x00}; fp@0: unsigned char sm3_31xx[] = {0x00, 0x11, 0x06, 0x00, 0x20, 0x00, 0x01, 0x00}; fp@0: fp@35: unsigned char sm2_41xx[] = {0x00, 0x10, 0x04, 0x00, 0x24, 0x00, 0x01, 0x00}; fp@0: fp@0: fp@0: unsigned char fmmu0_1014[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, fp@0: 0x00, 0x10, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}; fp@0: fp@0: unsigned char fmmu0_2004[] = {0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, fp@0: 0x00, 0x0F, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00}; fp@0: fp@0: unsigned char fmmu0_31xx[] = {0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x07, fp@0: 0x00, 0x11, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00}; fp@0: fp@35: unsigned char fmmu0_41xx[] = {0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x07, fp@0: 0x00, 0x10, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00}; fp@0: fp@0: int read_1014(unsigned char *data, unsigned int channel) fp@0: { fp@0: return (data[0] >> channel) & 0x01; fp@0: } fp@0: fp@0: void write_2004(unsigned char *data, unsigned int channel, int value) fp@0: { fp@0: if (value) fp@0: { fp@0: data[0] |= (1 << channel); fp@0: } fp@0: else fp@0: { fp@0: data[0] &= ~(1 << channel); fp@0: } fp@0: } fp@0: fp@0: int read_31xx(unsigned char *data, unsigned int channel) fp@0: { fp@0: return (short int) ((data[channel * 3 + 2] << 8) | data[channel * 3 + 1]); fp@0: } fp@0: fp@35: void write_41xx(unsigned char *data, unsigned int channel, int value) fp@0: { fp@0: data[channel * 3 + 1] = (value & 0xFF00) >> 8; fp@0: data[channel * 3 + 2] = value & 0xFF; fp@0: } fp@0: fp@0: /***************************************************************/ fp@0: fp@0: EtherCAT_slave_desc_t Beckhoff_EK1100[] = fp@0: {{ fp@0: "Beckhoff", "EK1100", "Bus Coupler", fp@0: ECAT_ST_SIMPLE_NOSYNC, fp@0: NULL, NULL, NULL, NULL, fp@0: NULL, fp@0: 0, 0, fp@0: NULL, NULL fp@0: }}; fp@0: fp@0: EtherCAT_slave_desc_t Beckhoff_EL1014[] = fp@0: {{ fp@0: "Beckhoff", "EL1014", "4x Digital Input", fp@0: ECAT_ST_SIMPLE, fp@0: sm0_1014, NULL, NULL, NULL, fp@0: fmmu0_1014, fp@0: 1, 4, fp@0: read_1014, NULL fp@0: }}; fp@0: fp@0: EtherCAT_slave_desc_t Beckhoff_EL2004[] = fp@0: {{ fp@0: "Beckhoff", "EL2004", "4x Digital Output", fp@0: ECAT_ST_SIMPLE, fp@0: sm0_2004, NULL, NULL, NULL, fp@0: fmmu0_2004, fp@0: 1, 4, fp@0: NULL, write_2004 fp@0: }}; fp@0: fp@0: EtherCAT_slave_desc_t Beckhoff_EL3102[] = fp@0: {{ fp@35: "Beckhoff", "EL3102", "2x Analog Input diff.", fp@0: ECAT_ST_MAILBOX, fp@0: sm0_multi, sm1_multi, sm2_31xx, sm3_31xx, fp@0: fmmu0_31xx, fp@0: 6, 2, fp@0: read_31xx, NULL fp@0: }}; fp@0: fp@0: EtherCAT_slave_desc_t Beckhoff_EL3162[] = fp@0: {{ fp@0: "Beckhoff", "EL3162", "2x Analog Input", fp@0: ECAT_ST_MAILBOX, fp@0: sm0_multi, sm1_multi, sm2_31xx, sm3_31xx, fp@0: fmmu0_31xx, fp@0: 6, 2, fp@0: read_31xx, NULL fp@0: }}; fp@0: fp@0: EtherCAT_slave_desc_t Beckhoff_EL4102[] = fp@0: {{ fp@0: "Beckhoff", "EL4102", "2x Analog Output", fp@0: ECAT_ST_MAILBOX, fp@35: sm0_multi, sm1_multi, sm2_41xx, NULL, fp@35: fmmu0_41xx, fp@0: 4, 2, fp@35: NULL, write_41xx fp@35: }}; fp@35: fp@35: EtherCAT_slave_desc_t Beckhoff_EL4132[] = fp@35: {{ fp@35: "Beckhoff", "EL4132", "2x Analog Output diff.", fp@35: ECAT_ST_MAILBOX, fp@35: sm0_multi, sm1_multi, sm2_41xx, NULL, fp@35: fmmu0_41xx, fp@35: 4, 2, fp@35: NULL, write_41xx fp@0: }}; fp@0: fp@0: EtherCAT_slave_desc_t Beckhoff_EL5001[] = fp@0: {{ fp@0: "Beckhoff", "EL5001", "SSI-Interface", fp@0: ECAT_ST_SIMPLE, fp@0: NULL, NULL, NULL, NULL, // Noch nicht eingepflegt... fp@0: NULL, fp@0: 0, 0, fp@0: NULL, NULL fp@0: }}; fp@0: fp@0: /***************************************************************/ fp@0: fp@0: unsigned int slave_idents_count = 7; fp@0: fp@17: struct slave_ident slave_idents[] = fp@0: { fp@0: {0x00000002, 0x03F63052, Beckhoff_EL1014}, fp@0: {0x00000002, 0x044C2C52, Beckhoff_EK1100}, fp@0: {0x00000002, 0x07D43052, Beckhoff_EL2004}, fp@0: {0x00000002, 0x0C1E3052, Beckhoff_EL3102}, fp@0: {0x00000002, 0x0C5A3052, Beckhoff_EL3162}, fp@0: {0x00000002, 0x10063052, Beckhoff_EL4102}, fp@35: {0x00000002, 0x10243052, Beckhoff_EL4132}, fp@0: {0x00000002, 0x13893052, Beckhoff_EL5001} fp@0: }; fp@0: fp@0: /***************************************************************/ fp@24: fp@24: EXPORT_SYMBOL(Beckhoff_EK1100); fp@24: EXPORT_SYMBOL(Beckhoff_EL1014); fp@24: EXPORT_SYMBOL(Beckhoff_EL2004); fp@24: EXPORT_SYMBOL(Beckhoff_EL3102); fp@24: EXPORT_SYMBOL(Beckhoff_EL3162); fp@24: EXPORT_SYMBOL(Beckhoff_EL4102); fp@35: EXPORT_SYMBOL(Beckhoff_EL4132); fp@24: EXPORT_SYMBOL(Beckhoff_EL5001);