master/fsm.c
changeset 306 45886de3db87
parent 304 558a6669da90
child 308 d50b139c8601
equal deleted inserted replaced
305:03aab3068f08 306:45886de3db87
   217         EC_INFO("Slave states: ");
   217         EC_INFO("Slave states: ");
   218         ec_print_states(fsm->master_slave_states);
   218         ec_print_states(fsm->master_slave_states);
   219         printk(".\n");
   219         printk(".\n");
   220     }
   220     }
   221 
   221 
   222     // topology change in free-run mode: clear all slaves and scan the bus
   222     // topology change in idle mode: clear all slaves and scan the bus
   223     if (topology_change && master->mode == EC_MASTER_MODE_FREERUN) {
   223     if (topology_change && master->mode == EC_MASTER_MODE_IDLE) {
   224         EC_INFO("Scanning bus.\n");
   224         EC_INFO("Scanning bus.\n");
   225 
   225 
   226         ec_master_eoe_stop(master);
   226         ec_master_eoe_stop(master);
   227         ec_master_clear_slaves(master);
   227         ec_master_clear_slaves(master);
   228 
   228 
   309         fsm->master_state = ec_fsm_master_configure_slave;
   309         fsm->master_state = ec_fsm_master_configure_slave;
   310         fsm->master_state(fsm); // execute immediately
   310         fsm->master_state(fsm); // execute immediately
   311         return;
   311         return;
   312     }
   312     }
   313 
   313 
   314     if (master->mode == EC_MASTER_MODE_FREERUN) {
   314     if (master->mode == EC_MASTER_MODE_IDLE) {
   315         // nothing to configure. check for pending EEPROM write operations.
   315         // nothing to configure. check for pending EEPROM write operations.
   316         list_for_each_entry(slave, &master->slaves, list) {
   316         list_for_each_entry(slave, &master->slaves, list) {
   317             if (!slave->new_eeprom_data) continue;
   317             if (!slave->new_eeprom_data) continue;
   318 
   318 
   319             if (!slave->online || slave->error_flag) {
   319             if (!slave->online || slave->error_flag) {
   668             slave->coupler_index = current_coupler_index;
   668             slave->coupler_index = current_coupler_index;
   669             slave->coupler_subindex = coupler_subindex;
   669             slave->coupler_subindex = coupler_subindex;
   670             coupler_subindex++;
   670             coupler_subindex++;
   671         }
   671         }
   672 
   672 
   673         if (master->mode == EC_MASTER_MODE_FREERUN) {
   673         if (master->mode == EC_MASTER_MODE_IDLE) {
   674             // start EoE processing
   674             // start EoE processing
   675             ec_master_eoe_start(master);
   675             ec_master_eoe_start(master);
   676         }
   676         }
   677 
   677 
   678         fsm->master_state = ec_fsm_master_start;
   678         fsm->master_state = ec_fsm_master_start;