diff --git a/NEWS b/NEWS index a36a1a2bd9423bd04da501071884590473a1e9b5..8fba5b876b396ebdbf4503d6ae82ec0359d332be 100644 --- a/NEWS +++ b/NEWS @@ -50,6 +50,8 @@ Changes in version 1.4.0: function. - Removed the bus_state and bus_tainted flags from ec_master_state_t. * Removed include/ecdb.h. +* Sdo dictionaries will now also be fetched in operation mode. +* SII write requests will now also be processed in operation mode. * Mapping of Pdo entries is now supported. * Current Pdo assignment/mapping is now read via CoE during bus scan, using direct Sdo access, independent of the dictionary. diff --git a/TODO b/TODO index 48cec52ef316017ec8fc7558793f93510fe2a89e..407282c495ee295f73e5262b215a099da756d9d9 100644 --- a/TODO +++ b/TODO @@ -16,7 +16,6 @@ Version 1.4.0: * Mailbox protocol handlers. * Remove get_cycles() calls and references to cpu_khz to increase portability. -* Scanning of Sdo dictionary / writing EEPROM in OPERATION state. * Remove the end state of the master state machine. * SDO write access in sysfs. * Update documentation. diff --git a/master/fsm_master.c b/master/fsm_master.c index 33fa03d439e911f1fa0481e47d510944cf5f21b3..ea77e7be101b5e5390904384041ca26dc95b2a0b 100644 --- a/master/fsm_master.c +++ b/master/fsm_master.c @@ -444,37 +444,34 @@ void ec_fsm_master_action_idle( if (ec_fsm_master_action_process_sdo(fsm)) return; - if (master->mode == EC_MASTER_MODE_IDLE) { - - // check, if slaves have an Sdo dictionary to read out. - list_for_each_entry(slave, &master->slaves, list) { - if (!(slave->sii.mailbox_protocols & EC_MBOX_COE) + // check, if slaves have an Sdo dictionary to read out. + list_for_each_entry(slave, &master->slaves, list) { + if (!(slave->sii.mailbox_protocols & EC_MBOX_COE) || slave->sdo_dictionary_fetched || slave->current_state == EC_SLAVE_STATE_INIT || jiffies - slave->jiffies_preop < EC_WAIT_SDO_DICT * HZ || slave->error_flag) continue; - if (master->debug_level) { - EC_DBG("Fetching Sdo dictionary from slave %u.\n", - slave->ring_position); - } - - slave->sdo_dictionary_fetched = 1; - - // start fetching Sdo dictionary - fsm->idle = 0; - fsm->slave = slave; - fsm->state = ec_fsm_master_state_sdo_dictionary; - ec_fsm_coe_dictionary(&fsm->fsm_coe, slave); - ec_fsm_coe_exec(&fsm->fsm_coe); // execute immediately - return; + if (master->debug_level) { + EC_DBG("Fetching Sdo dictionary from slave %u.\n", + slave->ring_position); } - // check for pending SII write operations. - if (ec_fsm_master_action_process_sii(fsm)) - return; // SII write request found + slave->sdo_dictionary_fetched = 1; + + // start fetching Sdo dictionary + fsm->idle = 0; + fsm->slave = slave; + fsm->state = ec_fsm_master_state_sdo_dictionary; + ec_fsm_coe_dictionary(&fsm->fsm_coe, slave); + ec_fsm_coe_exec(&fsm->fsm_coe); // execute immediately + return; } + // check for pending SII write operations. + if (ec_fsm_master_action_process_sii(fsm)) + return; // SII write request found + fsm->state = ec_fsm_master_state_end; } @@ -842,7 +839,7 @@ void ec_fsm_master_state_sdo_dictionary( if (master->debug_level) { unsigned int sdo_count, entry_count; ec_slave_sdo_dict_info(slave, &sdo_count, &entry_count); - EC_DBG("Fetched %i Sdos and %i entries from slave %i.\n", + EC_DBG("Fetched %u Sdos and %u entries from slave %u.\n", sdo_count, entry_count, slave->ring_position); }