fp@238: /****************************************************************************** fp@238: * fp@238: * $Id$ fp@238: * fp@238: * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH fp@238: * fp@238: * This file is part of the IgH EtherCAT Master. fp@238: * fp@238: * The IgH EtherCAT Master is free software; you can redistribute it fp@238: * and/or modify it under the terms of the GNU General Public License fp@246: * as published by the Free Software Foundation; either version 2 of the fp@246: * License, or (at your option) any later version. fp@238: * fp@238: * The IgH EtherCAT Master is distributed in the hope that it will be fp@238: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of fp@238: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fp@238: * GNU General Public License for more details. fp@238: * fp@238: * You should have received a copy of the GNU General Public License fp@238: * along with the IgH EtherCAT Master; if not, write to the Free Software fp@238: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@238: * fp@246: * The right to use EtherCAT Technology is granted and comes free of fp@246: * charge under condition of compatibility of product made by fp@246: * Licensee. People intending to distribute/sell products based on the fp@246: * code, have to sign an agreement to guarantee that products using fp@246: * software based on IgH EtherCAT master stay compatible with the actual fp@246: * EtherCAT specification (which are released themselves as an open fp@246: * standard) as the (only) precondition to have the right to use EtherCAT fp@246: * Technology, IP and trade marks. fp@246: * fp@238: *****************************************************************************/ fp@238: fp@238: /** fp@238: \file fp@528: EtherCAT slave state machines. fp@238: */ fp@238: fp@238: /*****************************************************************************/ fp@238: fp@238: #include "globals.h" fp@238: #include "master.h" fp@329: #include "mailbox.h" fp@528: #include "fsm_slave.h" fp@635: #include "fsm_mapping.h" fp@528: fp@528: /*****************************************************************************/ fp@528: fp@528: void ec_fsm_slave_scan_state_start(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_scan_state_address(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_scan_state_state(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_scan_state_base(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_scan_state_datalink(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_scan_state_eeprom_size(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_scan_state_eeprom_data(ec_fsm_slave_t *); fp@528: fp@528: void ec_fsm_slave_conf_state_start(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_conf_state_init(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_conf_state_clear_fmmus(ec_fsm_slave_t *); fp@623: void ec_fsm_slave_conf_state_mbox_sync(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_conf_state_preop(ec_fsm_slave_t *); fp@623: void ec_fsm_slave_conf_state_pdo_sync(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_conf_state_fmmu(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_conf_state_sdoconf(ec_fsm_slave_t *); fp@635: void ec_fsm_slave_conf_state_mapconf(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_conf_state_saveop(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_conf_state_op(ec_fsm_slave_t *); fp@528: fp@623: void ec_fsm_slave_conf_enter_mbox_sync(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_conf_enter_preop(ec_fsm_slave_t *); fp@623: void ec_fsm_slave_conf_enter_pdo_sync(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_conf_enter_fmmu(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_conf_enter_sdoconf(ec_fsm_slave_t *); fp@635: void ec_fsm_slave_conf_enter_mapconf(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_conf_enter_saveop(ec_fsm_slave_t *); fp@528: fp@528: void ec_fsm_slave_state_end(ec_fsm_slave_t *); fp@528: void ec_fsm_slave_state_error(ec_fsm_slave_t *); fp@251: fp@238: /*****************************************************************************/ fp@238: fp@260: /** fp@260: Constructor. fp@260: */ fp@260: fp@528: void ec_fsm_slave_init(ec_fsm_slave_t *fsm, /**< slave state machine */ fp@528: ec_datagram_t *datagram /**< datagram structure to use */ fp@528: ) fp@528: { fp@528: fsm->datagram = datagram; fp@528: fp@528: // init sub state machines fp@528: ec_fsm_sii_init(&fsm->fsm_sii, fsm->datagram); fp@528: ec_fsm_change_init(&fsm->fsm_change, fsm->datagram); fp@528: ec_fsm_coe_init(&fsm->fsm_coe, fsm->datagram); fp@635: ec_fsm_mapping_init(&fsm->fsm_map, &fsm->fsm_coe); fp@238: } fp@238: fp@238: /*****************************************************************************/ fp@238: fp@260: /** fp@260: Destructor. fp@260: */ fp@260: fp@528: void ec_fsm_slave_clear(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: // clear sub state machines fp@433: ec_fsm_sii_clear(&fsm->fsm_sii); fp@434: ec_fsm_change_clear(&fsm->fsm_change); fp@436: ec_fsm_coe_clear(&fsm->fsm_coe); fp@635: ec_fsm_mapping_clear(&fsm->fsm_map); fp@528: } fp@528: fp@528: /*****************************************************************************/ fp@528: fp@528: /** fp@528: * Start slave scan state machine. fp@528: */ fp@528: fp@528: void ec_fsm_slave_start_scan(ec_fsm_slave_t *fsm, /**< slave state machine */ fp@528: ec_slave_t *slave /**< slave to configure */ fp@528: ) fp@528: { fp@528: fsm->slave = slave; fp@528: fsm->state = ec_fsm_slave_scan_state_start; fp@528: } fp@528: fp@528: /*****************************************************************************/ fp@528: fp@528: /** fp@528: * Start slave configuration state machine. fp@528: */ fp@528: fp@528: void ec_fsm_slave_start_conf(ec_fsm_slave_t *fsm, /**< slave state machine */ fp@528: ec_slave_t *slave /**< slave to configure */ fp@528: ) fp@528: { fp@528: fsm->slave = slave; fp@528: fsm->state = ec_fsm_slave_conf_state_start; fp@528: } fp@528: fp@528: /*****************************************************************************/ fp@528: fp@528: /** fp@528: \return false, if state machine has terminated fp@528: */ fp@528: fp@528: int ec_fsm_slave_running(const ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: return fsm->state != ec_fsm_slave_state_end fp@528: && fsm->state != ec_fsm_slave_state_error; fp@238: } fp@238: fp@238: /*****************************************************************************/ fp@238: fp@260: /** fp@260: Executes the current state of the state machine. fp@505: If the state machine's datagram is not sent or received yet, the execution fp@505: of the state machine is delayed to the next cycle. fp@435: \return false, if state machine has terminated fp@435: */ fp@435: fp@528: int ec_fsm_slave_exec(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: if (fsm->datagram->state == EC_DATAGRAM_SENT fp@528: || fsm->datagram->state == EC_DATAGRAM_QUEUED) { fp@505: // datagram was not sent or received yet. fp@528: return ec_fsm_slave_running(fsm); fp@528: } fp@528: fp@528: fsm->state(fsm); fp@528: return ec_fsm_slave_running(fsm); fp@528: } fp@528: fp@528: /*****************************************************************************/ fp@528: fp@528: /** fp@528: \return true, if the state machine terminated gracefully fp@528: */ fp@528: fp@528: int ec_fsm_slave_success(const ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: return fsm->state == ec_fsm_slave_state_end; fp@446: } fp@446: fp@238: /****************************************************************************** fp@325: * slave scan state machine fp@238: *****************************************************************************/ fp@238: fp@238: /** fp@409: Slave scan state: START. fp@238: First state of the slave state machine. Writes the station address to the fp@238: slave, according to its ring position. fp@238: */ fp@238: fp@528: void ec_fsm_slave_scan_state_start(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@238: // write station address fp@528: ec_datagram_apwr(fsm->datagram, fsm->slave->ring_position, 0x0010, 2); fp@528: EC_WRITE_U16(fsm->datagram->data, fsm->slave->station_address); fp@505: fsm->retries = EC_FSM_RETRIES; fp@528: fsm->state = ec_fsm_slave_scan_state_address; fp@310: } fp@310: fp@310: /*****************************************************************************/ fp@310: fp@310: /** fp@409: Slave scan state: ADDRESS. fp@310: */ fp@310: fp@528: void ec_fsm_slave_scan_state_address(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: ec_datagram_t *datagram = fsm->datagram; fp@293: fp@637: if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) fp@637: return; fp@505: fp@505: if (datagram->state != EC_DATAGRAM_RECEIVED) { fp@528: fsm->state = ec_fsm_slave_state_error; fp@594: EC_ERR("Failed to receive station address datagram for slave %i" fp@594: " (datagram state %i)\n", fp@594: fsm->slave->ring_position, datagram->state); fp@505: return; fp@505: } fp@505: fp@505: if (datagram->working_counter != 1) { fp@292: fsm->slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@713: EC_ERR("Failed to write station address on slave %i: ", fp@238: fsm->slave->ring_position); fp@713: ec_datagram_print_wc_error(datagram); fp@292: return; fp@292: } fp@292: fp@292: // Read AL state fp@293: ec_datagram_nprd(datagram, fsm->slave->station_address, 0x0130, 2); fp@505: fsm->retries = EC_FSM_RETRIES; fp@528: fsm->state = ec_fsm_slave_scan_state_state; fp@310: } fp@310: fp@310: /*****************************************************************************/ fp@310: fp@310: /** fp@409: Slave scan state: STATE. fp@310: */ fp@310: fp@713: void ec_fsm_slave_scan_state_state( fp@713: ec_fsm_slave_t *fsm /**< slave state machine */ fp@713: ) fp@528: { fp@528: ec_datagram_t *datagram = fsm->datagram; fp@293: ec_slave_t *slave = fsm->slave; fp@293: fp@637: if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) fp@637: return; fp@505: fp@505: if (datagram->state != EC_DATAGRAM_RECEIVED) { fp@528: fsm->state = ec_fsm_slave_state_error; fp@594: EC_ERR("Failed to receive AL state datagram from slave %i" fp@594: " (datagram state %i).\n", fp@594: fsm->slave->ring_position, datagram->state); fp@505: return; fp@505: } fp@505: fp@505: if (datagram->working_counter != 1) { fp@291: fsm->slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@713: EC_ERR("Failed to read AL state of slave %i: ", fp@255: fsm->slave->ring_position); fp@713: ec_datagram_print_wc_error(datagram); fp@255: return; fp@255: } fp@255: fp@293: slave->current_state = EC_READ_U8(datagram->data); fp@402: if (slave->current_state & EC_SLAVE_STATE_ACK_ERR) { fp@454: char state_str[EC_STATE_STRING_SIZE]; fp@454: ec_state_string(slave->current_state, state_str); fp@454: EC_WARN("Slave %i has state error bit set (%s)!\n", fp@454: slave->ring_position, state_str); fp@255: } fp@255: fp@238: // read base data fp@293: ec_datagram_nprd(datagram, fsm->slave->station_address, 0x0000, 6); fp@505: fsm->retries = EC_FSM_RETRIES; fp@528: fsm->state = ec_fsm_slave_scan_state_base; fp@310: } fp@310: fp@310: /*****************************************************************************/ fp@310: fp@310: /** fp@409: Slave scan state: BASE. fp@310: */ fp@310: fp@528: void ec_fsm_slave_scan_state_base(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: ec_datagram_t *datagram = fsm->datagram; fp@293: ec_slave_t *slave = fsm->slave; fp@293: fp@637: if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) fp@637: return; fp@505: fp@505: if (datagram->state != EC_DATAGRAM_RECEIVED) { fp@528: fsm->state = ec_fsm_slave_state_error; fp@594: EC_ERR("Failed to receive base data datagram for slave %i" fp@594: " (datagram state %i).\n", fp@594: slave->ring_position, datagram->state); fp@505: return; fp@505: } fp@505: fp@505: if (datagram->working_counter != 1) { fp@291: fsm->slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@713: EC_ERR("Failed to read base data from slave %i: ", fp@238: slave->ring_position); fp@713: ec_datagram_print_wc_error(datagram); fp@238: return; fp@238: } fp@238: fp@293: slave->base_type = EC_READ_U8 (datagram->data); fp@293: slave->base_revision = EC_READ_U8 (datagram->data + 1); fp@293: slave->base_build = EC_READ_U16(datagram->data + 2); fp@293: slave->base_fmmu_count = EC_READ_U8 (datagram->data + 4); fp@238: fp@238: if (slave->base_fmmu_count > EC_MAX_FMMUS) fp@238: slave->base_fmmu_count = EC_MAX_FMMUS; fp@238: fp@238: // read data link status fp@293: ec_datagram_nprd(datagram, slave->station_address, 0x0110, 2); fp@505: fsm->retries = EC_FSM_RETRIES; fp@528: fsm->state = ec_fsm_slave_scan_state_datalink; fp@310: } fp@310: fp@310: /*****************************************************************************/ fp@310: fp@310: /** fp@409: Slave scan state: DATALINK. fp@310: */ fp@310: fp@528: void ec_fsm_slave_scan_state_datalink(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: ec_datagram_t *datagram = fsm->datagram; fp@238: ec_slave_t *slave = fsm->slave; fp@238: uint16_t dl_status; fp@238: unsigned int i; fp@238: fp@637: if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) fp@637: return; fp@505: fp@505: if (datagram->state != EC_DATAGRAM_RECEIVED) { fp@528: fsm->state = ec_fsm_slave_state_error; fp@594: EC_ERR("Failed to receive DL status datagram from slave %i" fp@594: " (datagram state %i).\n", fp@594: slave->ring_position, datagram->state); fp@505: return; fp@505: } fp@505: fp@505: if (datagram->working_counter != 1) { fp@291: fsm->slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@713: EC_ERR("Failed to read DL status from slave %i: ", fp@238: slave->ring_position); fp@713: ec_datagram_print_wc_error(datagram); fp@238: return; fp@238: } fp@238: fp@293: dl_status = EC_READ_U16(datagram->data); fp@238: for (i = 0; i < 4; i++) { fp@238: slave->dl_link[i] = dl_status & (1 << (4 + i)) ? 1 : 0; fp@238: slave->dl_loop[i] = dl_status & (1 << (8 + i * 2)) ? 1 : 0; fp@238: slave->dl_signal[i] = dl_status & (1 << (9 + i * 2)) ? 1 : 0; fp@238: } fp@238: fp@266: // Start fetching EEPROM size fp@266: fp@696: fsm->sii_offset = EC_FIRST_EEPROM_CATEGORY_OFFSET; // first category header fp@433: ec_fsm_sii_read(&fsm->fsm_sii, slave, fsm->sii_offset, EC_FSM_SII_NODE); fp@528: fsm->state = ec_fsm_slave_scan_state_eeprom_size; fp@528: fsm->state(fsm); // execute state immediately fp@238: } fp@238: fp@238: /*****************************************************************************/ fp@238: fp@238: /** fp@409: Slave scan state: EEPROM SIZE. fp@310: */ fp@310: fp@528: void ec_fsm_slave_scan_state_eeprom_size(ec_fsm_slave_t *fsm /**< slave state machine */) fp@266: { fp@266: ec_slave_t *slave = fsm->slave; fp@266: uint16_t cat_type, cat_size; fp@238: fp@435: if (ec_fsm_sii_exec(&fsm->fsm_sii)) return; fp@433: fp@433: if (!ec_fsm_sii_success(&fsm->fsm_sii)) { fp@292: fsm->slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@266: EC_ERR("Failed to read EEPROM size of slave %i.\n", fp@266: slave->ring_position); fp@238: return; fp@238: } fp@238: fp@433: cat_type = EC_READ_U16(fsm->fsm_sii.value); fp@433: cat_size = EC_READ_U16(fsm->fsm_sii.value + 2); fp@266: fp@266: if (cat_type != 0xFFFF) { // not the last category fp@266: fsm->sii_offset += cat_size + 2; fp@696: if (fsm->sii_offset >= EC_MAX_EEPROM_SIZE) { fp@696: EC_WARN("EEPROM size of slave %i exceeds" fp@696: " %i words (0xffff limiter missing?).\n", fp@696: slave->ring_position, EC_MAX_EEPROM_SIZE); fp@696: slave->eeprom_size = EC_FIRST_EEPROM_CATEGORY_OFFSET * 2; fp@696: goto alloc_eeprom; fp@696: } fp@433: ec_fsm_sii_read(&fsm->fsm_sii, slave, fsm->sii_offset, fp@433: EC_FSM_SII_NODE); fp@433: ec_fsm_sii_exec(&fsm->fsm_sii); // execute state immediately fp@266: return; fp@266: } fp@266: fp@266: slave->eeprom_size = (fsm->sii_offset + 1) * 2; fp@266: fp@696: alloc_eeprom: fp@266: if (slave->eeprom_data) { fp@266: EC_INFO("Freeing old EEPROM data on slave %i...\n", fp@266: slave->ring_position); fp@266: kfree(slave->eeprom_data); fp@266: } fp@266: fp@266: if (!(slave->eeprom_data = fp@734: (uint8_t *) kmalloc(slave->eeprom_size, GFP_ATOMIC))) { fp@734: slave->eeprom_size = 0; fp@734: slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@742: EC_ERR("Failed to allocate EEPROM data for slave %u.\n", fp@266: slave->ring_position); fp@266: return; fp@266: } fp@266: fp@266: // Start fetching EEPROM contents fp@266: fp@528: fsm->state = ec_fsm_slave_scan_state_eeprom_data; fp@266: fsm->sii_offset = 0x0000; fp@433: ec_fsm_sii_read(&fsm->fsm_sii, slave, fsm->sii_offset, EC_FSM_SII_NODE); fp@433: ec_fsm_sii_exec(&fsm->fsm_sii); // execute state immediately fp@238: } fp@238: fp@238: /*****************************************************************************/ fp@238: fp@238: /** fp@409: Slave scan state: EEPROM DATA. fp@310: */ fp@310: fp@528: void ec_fsm_slave_scan_state_eeprom_data(ec_fsm_slave_t *fsm /**< slave state machine */) fp@266: { fp@266: ec_slave_t *slave = fsm->slave; fp@742: uint16_t *cat_word, cat_type, cat_size, eeprom_word_size = slave->eeprom_size / 2; fp@266: fp@435: if (ec_fsm_sii_exec(&fsm->fsm_sii)) return; fp@433: fp@433: if (!ec_fsm_sii_success(&fsm->fsm_sii)) { fp@292: fsm->slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@266: EC_ERR("Failed to fetch EEPROM contents of slave %i.\n", fp@266: slave->ring_position); fp@238: return; fp@238: } fp@238: fp@266: // 2 words fetched fp@266: fp@742: if (fsm->sii_offset + 2 <= eeprom_word_size) { // 2 words fit fp@433: memcpy(slave->eeprom_data + fsm->sii_offset * 2, fp@433: fsm->fsm_sii.value, 4); fp@266: } fp@266: else { // copy the last word fp@433: memcpy(slave->eeprom_data + fsm->sii_offset * 2, fp@433: fsm->fsm_sii.value, 2); fp@266: } fp@266: fp@742: if (fsm->sii_offset + 2 < eeprom_word_size) { fp@266: // fetch the next 2 words fp@266: fsm->sii_offset += 2; fp@433: ec_fsm_sii_read(&fsm->fsm_sii, slave, fsm->sii_offset, fp@433: EC_FSM_SII_NODE); fp@433: ec_fsm_sii_exec(&fsm->fsm_sii); // execute state immediately fp@266: return; fp@266: } fp@266: fp@266: // Evaluate EEPROM contents fp@266: fp@266: slave->sii_alias = fp@266: EC_READ_U16(slave->eeprom_data + 2 * 0x0004); fp@266: slave->sii_vendor_id = fp@266: EC_READ_U32(slave->eeprom_data + 2 * 0x0008); fp@266: slave->sii_product_code = fp@266: EC_READ_U32(slave->eeprom_data + 2 * 0x000A); fp@266: slave->sii_revision_number = fp@266: EC_READ_U32(slave->eeprom_data + 2 * 0x000C); fp@266: slave->sii_serial_number = fp@266: EC_READ_U32(slave->eeprom_data + 2 * 0x000E); fp@266: slave->sii_rx_mailbox_offset = fp@266: EC_READ_U16(slave->eeprom_data + 2 * 0x0018); fp@266: slave->sii_rx_mailbox_size = fp@266: EC_READ_U16(slave->eeprom_data + 2 * 0x0019); fp@266: slave->sii_tx_mailbox_offset = fp@266: EC_READ_U16(slave->eeprom_data + 2 * 0x001A); fp@266: slave->sii_tx_mailbox_size = fp@266: EC_READ_U16(slave->eeprom_data + 2 * 0x001B); fp@266: slave->sii_mailbox_protocols = fp@266: EC_READ_U16(slave->eeprom_data + 2 * 0x001C); fp@266: fp@742: if (eeprom_word_size < EC_FIRST_EEPROM_CATEGORY_OFFSET + 1) { fp@742: EC_ERR("Unexpected end of EEPROM data in slave %u.\n", fp@742: slave->ring_position); fp@742: goto end; fp@742: } fp@742: fp@266: // evaluate category data fp@742: cat_word = fp@742: (uint16_t *) slave->eeprom_data + EC_FIRST_EEPROM_CATEGORY_OFFSET; fp@266: while (EC_READ_U16(cat_word) != 0xFFFF) { fp@742: fp@742: // type and size words must fit fp@742: if (cat_word + 2 - (uint16_t *) slave->eeprom_data fp@742: > eeprom_word_size) { fp@742: EC_ERR("Unexpected end of EEPROM data in slave %u.\n", fp@742: slave->ring_position); fp@742: goto end; fp@742: } fp@742: fp@266: cat_type = EC_READ_U16(cat_word) & 0x7FFF; fp@266: cat_size = EC_READ_U16(cat_word + 1); fp@742: cat_word += 2; fp@742: fp@742: if (cat_word + cat_size - (uint16_t *) slave->eeprom_data fp@742: > eeprom_word_size) { fp@742: EC_WARN("Unexpected end of EEPROM data in slave %u.\n", fp@742: slave->ring_position); fp@742: goto end; fp@742: } fp@266: fp@266: switch (cat_type) { fp@266: case 0x000A: fp@742: if (ec_slave_fetch_sii_strings(slave, (uint8_t *) cat_word, fp@742: cat_size * 2)) fp@266: goto end; fp@266: break; fp@266: case 0x001E: fp@742: if (ec_slave_fetch_sii_general(slave, (uint8_t *) cat_word, fp@742: cat_size * 2)) fp@742: goto end; fp@266: break; fp@266: case 0x0028: fp@266: break; fp@266: case 0x0029: fp@742: if (ec_slave_fetch_sii_syncs(slave, (uint8_t *) cat_word, fp@742: cat_size * 2)) fp@266: goto end; fp@266: break; fp@266: case 0x0032: fp@742: if (ec_slave_fetch_sii_pdos( slave, (uint8_t *) cat_word, fp@742: cat_size * 2, EC_TX_PDO)) fp@266: goto end; fp@266: break; fp@266: case 0x0033: fp@742: if (ec_slave_fetch_sii_pdos( slave, (uint8_t *) cat_word, fp@742: cat_size * 2, EC_RX_PDO)) fp@266: goto end; fp@266: break; fp@266: default: fp@528: if (fsm->slave->master->debug_level) fp@461: EC_WARN("Unknown category type 0x%04X in slave %i.\n", fp@461: cat_type, slave->ring_position); fp@266: } fp@266: fp@742: cat_word += cat_size; fp@742: if (cat_word - (uint16_t *) slave->eeprom_data >= eeprom_word_size) { fp@742: EC_WARN("Unexpected end of EEPROM data in slave %u.\n", fp@742: slave->ring_position); fp@742: goto end; fp@742: } fp@266: } fp@266: fp@528: fsm->state = ec_fsm_slave_state_end; fp@325: return; fp@310: fp@292: end: fp@325: EC_ERR("Failed to analyze category data.\n"); fp@291: fsm->slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@308: } fp@308: fp@308: /****************************************************************************** fp@325: * slave configuration state machine fp@308: *****************************************************************************/ fp@251: fp@251: /** fp@456: Slave configuration state: START. fp@456: */ fp@456: fp@528: void ec_fsm_slave_conf_state_start(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: if (fsm->slave->master->debug_level) { fp@456: EC_DBG("Configuring slave %i...\n", fsm->slave->ring_position); fp@456: } fp@456: fp@456: ec_fsm_change_start(&fsm->fsm_change, fsm->slave, EC_SLAVE_STATE_INIT); fp@456: ec_fsm_change_exec(&fsm->fsm_change); fp@528: fsm->state = ec_fsm_slave_conf_state_init; fp@456: } fp@456: fp@456: /*****************************************************************************/ fp@456: fp@456: /** fp@409: Slave configuration state: INIT. fp@309: */ fp@309: fp@528: void ec_fsm_slave_conf_state_init(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: ec_master_t *master = fsm->slave->master; fp@528: ec_slave_t *slave = fsm->slave; fp@528: ec_datagram_t *datagram = fsm->datagram; fp@462: fp@462: if (ec_fsm_change_exec(&fsm->fsm_change)) return; fp@462: fp@462: if (!ec_fsm_change_success(&fsm->fsm_change)) { fp@738: if (!fsm->fsm_change.spontaneous_change) fp@738: slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@462: return; fp@462: } fp@462: fp@523: slave->self_configured = 1; fp@523: fp@462: if (master->debug_level) { fp@462: EC_DBG("Slave %i is now in INIT.\n", slave->ring_position); fp@462: } fp@462: fp@462: // check and reset CRC fault counters fp@462: //ec_slave_check_crc(slave); fp@462: // TODO: Implement state machine for CRC checking. fp@462: fp@462: if (!slave->base_fmmu_count) { // skip FMMU configuration fp@623: ec_fsm_slave_conf_enter_mbox_sync(fsm); fp@462: return; fp@462: } fp@462: fp@462: if (master->debug_level) fp@462: EC_DBG("Clearing FMMU configurations of slave %i...\n", fp@462: slave->ring_position); fp@462: fp@462: // clear FMMU configurations fp@462: ec_datagram_npwr(datagram, slave->station_address, fp@462: 0x0600, EC_FMMU_SIZE * slave->base_fmmu_count); fp@462: memset(datagram->data, 0x00, EC_FMMU_SIZE * slave->base_fmmu_count); fp@505: fsm->retries = EC_FSM_RETRIES; fp@528: fsm->state = ec_fsm_slave_conf_state_clear_fmmus; fp@462: } fp@462: fp@462: /*****************************************************************************/ fp@462: fp@462: /** fp@462: Slave configuration state: CLEAR FMMU. fp@462: */ fp@462: fp@528: void ec_fsm_slave_conf_state_clear_fmmus(ec_fsm_slave_t *fsm fp@528: /**< slave state machine */) fp@528: { fp@528: ec_datagram_t *datagram = fsm->datagram; fp@462: fp@637: if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) fp@637: return; fp@505: fp@505: if (datagram->state != EC_DATAGRAM_RECEIVED) { fp@528: fsm->state = ec_fsm_slave_state_error; fp@505: EC_ERR("Failed receive FMMU clearing datagram for slave %i.\n", fp@505: fsm->slave->ring_position); fp@505: return; fp@505: } fp@505: fp@505: if (datagram->working_counter != 1) { fp@462: fsm->slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@713: EC_ERR("Failed to clear FMMUs of slave %i: ", fp@462: fsm->slave->ring_position); fp@713: ec_datagram_print_wc_error(datagram); fp@462: return; fp@462: } fp@462: fp@623: ec_fsm_slave_conf_enter_mbox_sync(fsm); fp@623: } fp@623: fp@623: /*****************************************************************************/ fp@623: fp@623: /** fp@628: */ fp@628: fp@628: void ec_fsm_slave_conf_enter_mbox_sync( fp@628: ec_fsm_slave_t *fsm /**< slave state machine */ fp@628: ) fp@528: { fp@528: ec_master_t *master = fsm->slave->master; fp@528: ec_slave_t *slave = fsm->slave; fp@528: ec_datagram_t *datagram = fsm->datagram; fp@618: unsigned int i; fp@251: fp@251: // slave is now in INIT fp@251: if (slave->current_state == slave->requested_state) { fp@528: fsm->state = ec_fsm_slave_state_end; // successful fp@409: if (master->debug_level) { fp@409: EC_DBG("Finished configuration of slave %i.\n", fp@409: slave->ring_position); fp@409: } fp@325: return; fp@251: } fp@251: fp@737: if (!slave->sii_mailbox_protocols) { fp@737: // no mailbox protocols supported fp@731: if (master->debug_level) fp@731: EC_DBG("Slave %i does not support mailbox communication.\n", fp@731: slave->ring_position); fp@528: ec_fsm_slave_conf_enter_preop(fsm); fp@251: return; fp@251: } fp@251: fp@409: if (master->debug_level) { fp@618: EC_DBG("Configuring mailbox sync managers of slave %i.\n", fp@409: slave->ring_position); fp@409: } fp@409: fp@737: if (slave->sii_sync_count >= 2) { fp@737: // configure sync managers fp@737: ec_datagram_npwr(datagram, slave->station_address, 0x0800, fp@737: EC_SYNC_SIZE * slave->sii_sync_count); fp@737: memset(datagram->data, 0x00, EC_SYNC_SIZE * slave->sii_sync_count); fp@737: fp@737: for (i = 0; i < 2; i++) { fp@737: ec_sync_config(&slave->sii_syncs[i], fp@737: datagram->data + EC_SYNC_SIZE * i); fp@737: } fp@737: } else { // no mailbox sync manager configurations provided fp@737: ec_sync_t sync; fp@737: fp@737: if (master->debug_level) fp@737: EC_DBG("Slave %i does not provide" fp@737: " mailbox sync manager configurations.\n", fp@737: slave->ring_position); fp@737: fp@737: ec_datagram_npwr(datagram, slave->station_address, 0x0800, fp@737: EC_SYNC_SIZE * 2); fp@737: memset(datagram->data, 0x00, EC_SYNC_SIZE * 2); fp@737: fp@737: ec_sync_init(&sync, slave, 0); fp@737: sync.physical_start_address = slave->sii_rx_mailbox_offset; fp@737: sync.length = slave->sii_rx_mailbox_size; fp@737: sync.control_register = 0x26; fp@737: sync.enable = 1; fp@737: ec_sync_config(&sync, datagram->data + EC_SYNC_SIZE * sync.index); fp@737: fp@737: ec_sync_init(&sync, slave, 1); fp@737: sync.physical_start_address = slave->sii_tx_mailbox_offset; fp@737: sync.length = slave->sii_tx_mailbox_size; fp@737: sync.control_register = 0x22; fp@737: sync.enable = 1; fp@737: ec_sync_config(&sync, datagram->data + EC_SYNC_SIZE * sync.index); fp@251: } fp@251: fp@505: fsm->retries = EC_FSM_RETRIES; fp@623: fsm->state = ec_fsm_slave_conf_state_mbox_sync; fp@309: } fp@309: fp@309: /*****************************************************************************/ fp@309: fp@309: /** fp@409: Slave configuration state: SYNC. fp@309: */ fp@309: fp@623: void ec_fsm_slave_conf_state_mbox_sync(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: ec_datagram_t *datagram = fsm->datagram; fp@293: ec_slave_t *slave = fsm->slave; fp@293: fp@637: if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) fp@637: return; fp@505: fp@505: if (datagram->state != EC_DATAGRAM_RECEIVED) { fp@528: fsm->state = ec_fsm_slave_state_error; fp@505: EC_ERR("Failed to receive sync manager configuration datagram for" fp@594: " slave %i (datagram state %i).\n", fp@594: slave->ring_position, datagram->state); fp@505: return; fp@505: } fp@505: fp@505: if (datagram->working_counter != 1) { fp@292: slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@713: EC_ERR("Failed to set sync managers of slave %i: ", fp@251: slave->ring_position); fp@713: ec_datagram_print_wc_error(datagram); fp@251: return; fp@251: } fp@251: fp@528: ec_fsm_slave_conf_enter_preop(fsm); fp@462: } fp@462: fp@462: /*****************************************************************************/ fp@462: fp@462: /** fp@462: */ fp@462: fp@528: void ec_fsm_slave_conf_enter_preop(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: fsm->state = ec_fsm_slave_conf_state_preop; fp@462: ec_fsm_change_start(&fsm->fsm_change, fsm->slave, EC_SLAVE_STATE_PREOP); fp@434: ec_fsm_change_exec(&fsm->fsm_change); // execute immediately fp@251: } fp@251: fp@251: /*****************************************************************************/ fp@251: fp@251: /** fp@409: Slave configuration state: PREOP. fp@309: */ fp@309: fp@528: void ec_fsm_slave_conf_state_preop(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: ec_slave_t *slave = fsm->slave; fp@528: ec_master_t *master = fsm->slave->master; fp@251: fp@435: if (ec_fsm_change_exec(&fsm->fsm_change)) return; fp@434: fp@434: if (!ec_fsm_change_success(&fsm->fsm_change)) { fp@738: if (!fsm->fsm_change.spontaneous_change) fp@738: slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@325: return; fp@325: } fp@325: fp@251: // slave is now in PREOP fp@528: slave->jiffies_preop = fsm->datagram->jiffies_received; fp@409: fp@409: if (master->debug_level) { fp@409: EC_DBG("Slave %i is now in PREOP.\n", slave->ring_position); fp@409: } fp@409: fp@419: if (slave->current_state == slave->requested_state) { fp@528: fsm->state = ec_fsm_slave_state_end; // successful fp@419: if (master->debug_level) { fp@419: EC_DBG("Finished configuration of slave %i.\n", fp@419: slave->ring_position); fp@419: } fp@419: return; fp@419: } fp@419: fp@635: ec_fsm_slave_conf_enter_sdoconf(fsm); fp@635: } fp@635: fp@635: /*****************************************************************************/ fp@635: fp@635: /** fp@635: */ fp@635: fp@635: void ec_fsm_slave_conf_enter_sdoconf(ec_fsm_slave_t *fsm /**< slave state machine */) fp@635: { fp@635: ec_slave_t *slave = fsm->slave; fp@635: fp@635: // No CoE configuration to be applied? fp@635: if (list_empty(&slave->sdo_confs)) { // skip SDO configuration fp@635: ec_fsm_slave_conf_enter_mapconf(fsm); fp@635: return; fp@635: } fp@635: fp@635: // start SDO configuration fp@635: fsm->state = ec_fsm_slave_conf_state_sdoconf; fp@635: fsm->sdodata = list_entry(fsm->slave->sdo_confs.next, ec_sdo_data_t, list); fp@635: ec_fsm_coe_download(&fsm->fsm_coe, fsm->slave, fsm->sdodata); fp@635: ec_fsm_coe_exec(&fsm->fsm_coe); // execute immediately fp@635: } fp@635: fp@635: /*****************************************************************************/ fp@635: fp@635: /** fp@635: Slave configuration state: SDOCONF. fp@635: */ fp@635: fp@635: void ec_fsm_slave_conf_state_sdoconf( fp@635: ec_fsm_slave_t *fsm /**< slave state machine */ fp@635: ) fp@635: { fp@635: if (ec_fsm_coe_exec(&fsm->fsm_coe)) return; fp@635: fp@635: if (!ec_fsm_coe_success(&fsm->fsm_coe)) { fp@635: EC_ERR("SDO configuration failed for slave %u.\n", fp@635: fsm->slave->ring_position); fp@635: fsm->slave->error_flag = 1; fp@635: fsm->state = ec_fsm_slave_state_error; fp@635: return; fp@635: } fp@635: fp@635: // Another SDO to configure? fp@635: if (fsm->sdodata->list.next != &fsm->slave->sdo_confs) { fp@635: fsm->sdodata = list_entry(fsm->sdodata->list.next, fp@635: ec_sdo_data_t, list); fp@635: ec_fsm_coe_download(&fsm->fsm_coe, fsm->slave, fsm->sdodata); fp@635: ec_fsm_coe_exec(&fsm->fsm_coe); // execute immediately fp@635: return; fp@635: } fp@635: fp@635: // All SDOs are now configured. fp@635: ec_fsm_slave_conf_enter_mapconf(fsm); fp@635: } fp@635: fp@635: /*****************************************************************************/ fp@635: fp@635: /** fp@635: */ fp@635: fp@635: void ec_fsm_slave_conf_enter_mapconf( fp@635: ec_fsm_slave_t *fsm /**< slave state machine */ fp@635: ) fp@635: { fp@635: ec_slave_t *slave = fsm->slave; fp@635: fp@635: if (!(slave->sii_mailbox_protocols & EC_MBOX_COE)) { fp@635: // Slave does not support CoE: no configuration of PDO mapping. fp@635: ec_fsm_slave_conf_enter_pdo_sync(fsm); fp@635: return; fp@635: } fp@635: fp@635: // start configuring PDO mapping fp@635: fsm->state = ec_fsm_slave_conf_state_mapconf; fp@635: ec_fsm_mapping_start(&fsm->fsm_map, fsm->slave); fp@635: ec_fsm_mapping_exec(&fsm->fsm_map); // execute immediately fp@635: } fp@635: fp@635: /*****************************************************************************/ fp@635: fp@635: /** fp@635: Slave configuration state: MAPCONF. fp@635: */ fp@635: fp@635: void ec_fsm_slave_conf_state_mapconf( fp@635: ec_fsm_slave_t *fsm /**< slave state machine */ fp@635: ) fp@635: { fp@635: if (ec_fsm_mapping_exec(&fsm->fsm_map)) return; fp@635: fp@635: if (!ec_fsm_mapping_success(&fsm->fsm_map)) { fp@635: EC_ERR("PDO mapping configuration failed for slave %u.\n", fp@635: fsm->slave->ring_position); fp@635: fsm->slave->error_flag = 1; fp@635: fsm->state = ec_fsm_slave_state_error; fp@635: return; fp@635: } fp@635: fp@623: ec_fsm_slave_conf_enter_pdo_sync(fsm); fp@623: } fp@623: fp@623: /*****************************************************************************/ fp@623: fp@623: /** fp@628: */ fp@628: fp@628: void ec_fsm_slave_conf_enter_pdo_sync( fp@628: ec_fsm_slave_t *fsm /**< slave state machine */ fp@628: ) fp@528: { fp@528: ec_slave_t *slave = fsm->slave; fp@528: ec_datagram_t *datagram = fsm->datagram; fp@618: unsigned int i; fp@618: fp@618: if (!slave->sii_sync_count) { fp@528: ec_fsm_slave_conf_enter_fmmu(fsm); fp@478: return; fp@478: } fp@478: fp@478: // configure sync managers for process data fp@478: ec_datagram_npwr(datagram, slave->station_address, 0x0800, fp@618: EC_SYNC_SIZE * slave->sii_sync_count); fp@618: memset(datagram->data, 0x00, EC_SYNC_SIZE * slave->sii_sync_count); fp@618: fp@618: for (i = 0; i < slave->sii_sync_count; i++) { fp@628: ec_sync_config(&slave->sii_syncs[i], fp@618: datagram->data + EC_SYNC_SIZE * i); fp@478: } fp@478: fp@505: fsm->retries = EC_FSM_RETRIES; fp@623: fsm->state = ec_fsm_slave_conf_state_pdo_sync; fp@478: } fp@478: fp@478: /*****************************************************************************/ fp@478: fp@478: /** fp@635: */ fp@478: fp@623: void ec_fsm_slave_conf_state_pdo_sync(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: ec_datagram_t *datagram = fsm->datagram; fp@478: ec_slave_t *slave = fsm->slave; fp@478: fp@637: if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) fp@637: return; fp@505: fp@505: if (datagram->state != EC_DATAGRAM_RECEIVED) { fp@528: fsm->state = ec_fsm_slave_state_error; fp@505: EC_ERR("Failed to receive process data sync manager configuration" fp@594: " datagram for slave %i (datagram state %i).\n", fp@594: slave->ring_position, datagram->state); fp@505: return; fp@505: } fp@505: fp@505: if (datagram->working_counter != 1) { fp@478: slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@713: EC_ERR("Failed to set process data sync managers of slave %i: ", fp@713: slave->ring_position); fp@713: ec_datagram_print_wc_error(datagram); fp@478: return; fp@478: } fp@478: fp@528: ec_fsm_slave_conf_enter_fmmu(fsm); fp@528: } fp@528: fp@528: /*****************************************************************************/ fp@528: fp@528: /** fp@528: */ fp@528: fp@528: void ec_fsm_slave_conf_enter_fmmu(ec_fsm_slave_t *fsm /**< slave state machine */) fp@478: { fp@478: ec_slave_t *slave = fsm->slave; fp@528: ec_datagram_t *datagram = fsm->datagram; fp@478: unsigned int j; fp@478: fp@419: if (!slave->base_fmmu_count) { // skip FMMU configuration fp@635: ec_fsm_slave_conf_enter_saveop(fsm); fp@251: return; fp@251: } fp@251: fp@251: // configure FMMUs fp@293: ec_datagram_npwr(datagram, slave->station_address, fp@293: 0x0600, EC_FMMU_SIZE * slave->base_fmmu_count); fp@293: memset(datagram->data, 0x00, EC_FMMU_SIZE * slave->base_fmmu_count); fp@251: for (j = 0; j < slave->fmmu_count; j++) { fp@630: ec_fmmu_config(&slave->fmmus[j], datagram->data + EC_FMMU_SIZE * j); fp@293: } fp@293: fp@505: fsm->retries = EC_FSM_RETRIES; fp@528: fsm->state = ec_fsm_slave_conf_state_fmmu; fp@309: } fp@309: fp@309: /*****************************************************************************/ fp@309: fp@309: /** fp@409: Slave configuration state: FMMU. fp@309: */ fp@309: fp@528: void ec_fsm_slave_conf_state_fmmu(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: ec_datagram_t *datagram = fsm->datagram; fp@419: ec_slave_t *slave = fsm->slave; fp@309: fp@637: if (datagram->state == EC_DATAGRAM_TIMED_OUT && fsm->retries--) fp@637: return; fp@505: fp@505: if (datagram->state != EC_DATAGRAM_RECEIVED) { fp@528: fsm->state = ec_fsm_slave_state_error; fp@594: EC_ERR("Failed to receive FMMUs datagram for slave %i" fp@594: " (datagram state %i).\n", fp@615: slave->ring_position, datagram->state); fp@505: return; fp@505: } fp@505: fp@505: if (datagram->working_counter != 1) { fp@615: slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@713: EC_ERR("Failed to set FMMUs of slave %i: ", fp@615: slave->ring_position); fp@713: ec_datagram_print_wc_error(datagram); fp@615: return; fp@615: } fp@615: fp@528: ec_fsm_slave_conf_enter_saveop(fsm); fp@462: } fp@462: fp@462: /*****************************************************************************/ fp@462: fp@462: /** fp@462: */ fp@462: fp@528: void ec_fsm_slave_conf_enter_saveop(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: fsm->state = ec_fsm_slave_conf_state_saveop; fp@454: ec_fsm_change_start(&fsm->fsm_change, fsm->slave, EC_SLAVE_STATE_SAVEOP); fp@434: ec_fsm_change_exec(&fsm->fsm_change); // execute immediately fp@251: } fp@251: fp@251: /*****************************************************************************/ fp@251: fp@251: /** fp@409: Slave configuration state: SAVEOP. fp@309: */ fp@309: fp@528: void ec_fsm_slave_conf_state_saveop(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: ec_master_t *master = fsm->slave->master; fp@409: ec_slave_t *slave = fsm->slave; fp@409: fp@435: if (ec_fsm_change_exec(&fsm->fsm_change)) return; fp@434: fp@434: if (!ec_fsm_change_success(&fsm->fsm_change)) { fp@738: if (!fsm->fsm_change.spontaneous_change) fp@738: fsm->slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@325: return; fp@325: } fp@325: fp@251: // slave is now in SAVEOP fp@409: fp@409: if (master->debug_level) { fp@411: EC_DBG("Slave %i is now in SAVEOP.\n", slave->ring_position); fp@409: } fp@409: fp@251: if (fsm->slave->current_state == fsm->slave->requested_state) { fp@528: fsm->state = ec_fsm_slave_state_end; // successful fp@409: if (master->debug_level) { fp@409: EC_DBG("Finished configuration of slave %i.\n", fp@409: slave->ring_position); fp@409: } fp@251: return; fp@251: } fp@251: fp@251: // set state to OP fp@528: fsm->state = ec_fsm_slave_conf_state_op; fp@454: ec_fsm_change_start(&fsm->fsm_change, slave, EC_SLAVE_STATE_OP); fp@434: ec_fsm_change_exec(&fsm->fsm_change); // execute immediately fp@251: } fp@251: fp@251: /*****************************************************************************/ fp@251: fp@251: /** fp@409: Slave configuration state: OP fp@309: */ fp@309: fp@528: void ec_fsm_slave_conf_state_op(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: ec_master_t *master = fsm->slave->master; fp@409: ec_slave_t *slave = fsm->slave; fp@409: fp@435: if (ec_fsm_change_exec(&fsm->fsm_change)) return; fp@434: fp@434: if (!ec_fsm_change_success(&fsm->fsm_change)) { fp@738: if (!fsm->fsm_change.spontaneous_change) fp@738: slave->error_flag = 1; fp@528: fsm->state = ec_fsm_slave_state_error; fp@325: return; fp@325: } fp@325: fp@251: // slave is now in OP fp@409: fp@409: if (master->debug_level) { fp@409: EC_DBG("Slave %i is now in OP.\n", slave->ring_position); fp@409: EC_DBG("Finished configuration of slave %i.\n", slave->ring_position); fp@409: } fp@409: fp@528: fsm->state = ec_fsm_slave_state_end; // successful fp@238: } fp@238: fp@238: /****************************************************************************** fp@329: * Common state functions fp@329: *****************************************************************************/ fp@286: fp@286: /** fp@325: State: ERROR. fp@325: */ fp@325: fp@528: void ec_fsm_slave_state_error(ec_fsm_slave_t *fsm /**< slave state machine */) fp@325: { fp@325: } fp@325: fp@325: /*****************************************************************************/ fp@325: fp@325: /** fp@325: State: END. fp@325: */ fp@325: fp@528: void ec_fsm_slave_state_end(ec_fsm_slave_t *fsm /**< slave state machine */) fp@528: { fp@528: } fp@528: fp@528: /*****************************************************************************/