master/fsm_mapping.c
changeset 660 582a90a34303
parent 635 d304ef4af542
child 758 8fa6f825eb7d
equal deleted inserted replaced
659:d7c5a958bad0 660:582a90a34303
   159 
   159 
   160 void ec_fsm_mapping_next_sync(
   160 void ec_fsm_mapping_next_sync(
   161         ec_fsm_mapping_t *fsm /**< mapping state machine */
   161         ec_fsm_mapping_t *fsm /**< mapping state machine */
   162         )
   162         )
   163 {
   163 {
   164     do {
   164     while (1) {
   165         if (fsm->dir > EC_DIR_INPUT) {
   165         if (fsm->dir > EC_DIR_INPUT) {
   166             // no more sync managers to configure mappings for
   166             // no more directions to configure mappings for
   167             fsm->state = ec_fsm_mapping_state_end;
   167             fsm->state = ec_fsm_mapping_state_end;
   168             return;
   168             return;
   169         }
   169         }
   170 
   170 
   171         if (!(fsm->sync = ec_slave_get_pdo_sync(fsm->slave, fsm->dir))) {
   171         if (!(fsm->sync = ec_slave_get_pdo_sync(fsm->slave, fsm->dir))) {
   172             fsm->state = ec_fsm_mapping_state_error;
   172             // no sync manager found for this direction
   173             return;
   173             fsm->dir++;
       
   174             continue;
   174         }
   175         }
       
   176 
   175         fsm->dir++;
   177         fsm->dir++;
   176     }
   178         if (fsm->sync->alt_mapping)
   177     while (!fsm->sync->alt_mapping);
   179             break;
       
   180     }
   178 
   181 
   179     if (fsm->slave->master->debug_level) {
   182     if (fsm->slave->master->debug_level) {
   180         EC_DBG("Configuring PDO mapping for SM%u of slave %i.\n",
   183         EC_DBG("Configuring PDO mapping for SM%u of slave %i.\n",
   181                 fsm->sync->index, fsm->slave->ring_position);
   184                 fsm->sync->index, fsm->slave->ring_position);
   182     }
   185     }